Generator Changes at 9/27/2025 8:46:36 AM
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
using CMSMicroservice.Domain.Entities;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
|
||||
namespace CMSMicroservice.Infrastructure.Persistence.Configurations;
|
||||
|
||||
public class UserConfiguration : IEntityTypeConfiguration<User>
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<User> 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.FirstName).IsRequired(false);
|
||||
builder.Property(entity => entity.LastName).IsRequired(false);
|
||||
builder.Property(entity => entity.Mobile).IsRequired(true);
|
||||
builder.Property(entity => entity.NationalCode).IsRequired(false);
|
||||
builder.Property(entity => entity.AvatarPath).IsRequired(false);
|
||||
builder
|
||||
.HasOne(entity => entity.Parent)
|
||||
.WithMany(entity => entity.Users)
|
||||
.HasForeignKey(entity => entity.ParentId)
|
||||
.IsRequired(false);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user