#region ========================================================================= USING =====================================================================================
using Lumina.Application.Common.DataAccess.Entities.Authorization;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
#endregion
namespace Lumina.DataAccess.Common.Configuration;
///
/// Configures the entity mapping for the entity.
///
public class RoleConfiguration : IEntityTypeConfiguration
{
///
/// Configures the entity.
///
/// The builder to be used to configure the entity.
public void Configure(EntityTypeBuilder builder)
{
builder.ToTable("Roles");
builder.HasKey(role => role.Id);
builder.Property(role => role.Id)
.ValueGeneratedOnAdd()
.HasColumnOrder(0);
builder.Property(role => role.RoleName)
.IsRequired()
.HasMaxLength(100)
.HasColumnOrder(1);
// Audit.
builder.Property(role => role.CreatedOnUtc)
.IsRequired()
.HasColumnOrder(3);
builder.Property(role => role.CreatedBy)
.IsRequired()
.HasColumnOrder(4);
builder.Property(role => role.UpdatedOnUtc)
.HasDefaultValue(null)
.HasColumnOrder(5);
builder.Property(role => role.UpdatedBy)
.HasDefaultValue(null)
.HasColumnOrder(6);
}
}