update
This commit is contained in:
@@ -42,7 +42,8 @@ public class ApplicationDbContext : DbContext, IApplicationDbContext
|
||||
public DbSet<UserAddress> UserAddresss => Set<UserAddress>();
|
||||
public DbSet<Package> Packages => Set<Package>();
|
||||
public DbSet<Role> Roles => Set<Role>();
|
||||
public DbSet<Category> Categorys => Set<Category>();
|
||||
public DbSet<Category> Categories => Set<Category>();
|
||||
public DbSet<Tag> Tags => Set<Tag>();
|
||||
public DbSet<UserRole> UserRoles => Set<UserRole>();
|
||||
public DbSet<UserWallet> UserWallets => Set<UserWallet>();
|
||||
public DbSet<UserWalletChangeLog> UserWalletChangeLogs => Set<UserWalletChangeLog>();
|
||||
|
||||
@@ -13,7 +13,7 @@ public class PruductCategoryConfiguration : IEntityTypeConfiguration<PruductCate
|
||||
builder.Property(entity => entity.Id).UseIdentityColumn();
|
||||
builder
|
||||
.HasOne(entity => entity.Product)
|
||||
.WithMany(entity => entity.ProductPruductCategorys)
|
||||
.WithMany(entity => entity.PruductCategorys)
|
||||
.HasForeignKey(entity => entity.ProductId)
|
||||
.IsRequired(true);
|
||||
builder
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
using CMSMicroservice.Domain.Entities;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
|
||||
namespace CMSMicroservice.Infrastructure.Persistence.Configurations;
|
||||
|
||||
//برچسب محصول
|
||||
public class PruductTagConfiguration : IEntityTypeConfiguration<PruductTag>
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<PruductTag> builder)
|
||||
{
|
||||
builder.HasQueryFilter(p => !p.IsDeleted);
|
||||
builder.Ignore(entity => entity.DomainEvents);
|
||||
builder.HasKey(entity => entity.Id);
|
||||
builder.Property(entity => entity.Id).UseIdentityColumn();
|
||||
|
||||
builder
|
||||
.HasOne(entity => entity.Product)
|
||||
.WithMany(entity => entity.PruductTags)
|
||||
.HasForeignKey(entity => entity.ProductId)
|
||||
.IsRequired(true);
|
||||
|
||||
builder
|
||||
.HasOne(entity => entity.Tag)
|
||||
.WithMany(entity => entity.PruductTags)
|
||||
.HasForeignKey(entity => entity.TagId)
|
||||
.IsRequired(true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
using CMSMicroservice.Domain.Entities;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
|
||||
namespace CMSMicroservice.Infrastructure.Persistence.Configurations;
|
||||
|
||||
public class TagConfiguration : IEntityTypeConfiguration<Tag>
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<Tag> builder)
|
||||
{
|
||||
builder.HasQueryFilter(p => !p.IsDeleted);
|
||||
builder.Ignore(entity => entity.DomainEvents);
|
||||
builder.HasKey(entity => entity.Id);
|
||||
builder.Property(entity => entity.Id).UseIdentityColumn();
|
||||
|
||||
builder.Property(entity => entity.Name).IsRequired(true);
|
||||
builder.Property(entity => entity.Title).IsRequired(true);
|
||||
builder.Property(entity => entity.Description).IsRequired(false);
|
||||
builder.Property(entity => entity.IsActive).IsRequired(true);
|
||||
builder.Property(entity => entity.SortOrder).IsRequired(true);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user