Files
CMS/src/CMSMicroservice.Infrastructure/Persistence/Configurations/ClubFeatureConfiguration.cs
T

29 lines
1.1 KiB
C#

using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace CMSMicroservice.Infrastructure.Persistence.Configurations;
/// <summary>
/// فیچرهای باشگاه مشتریان
/// </summary>
public class ClubFeatureConfiguration : IEntityTypeConfiguration<ClubFeature>
{
public void Configure(EntityTypeBuilder<ClubFeature> 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.Title).IsRequired().HasMaxLength(200);
builder.Property(entity => entity.Description).IsRequired(false).HasMaxLength(1000);
builder.Property(entity => entity.IsActive).IsRequired();
builder.Property(entity => entity.SortOrder).IsRequired();
// Index برای IsActive و SortOrder
builder.HasIndex(e => new { e.IsActive, e.SortOrder })
.HasDatabaseName("IX_ClubFeature_IsActive_SortOrder");
}
}