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