This commit is contained in:
masoodafar-web
2025-11-18 22:38:50 +03:30
parent dba8aecc97
commit f6dcd43346
76 changed files with 3778 additions and 1386 deletions

View File

@@ -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>();

View File

@@ -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

View File

@@ -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);
}
}

View File

@@ -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);
}
}