In EF Core 2.0, we have the ability to derive from IEntityTypeConfiguration
for cleaner Fluent API mappings (source).
How can I extend this pattern to utili
Something like this could work (untested)?
public abstract class BaseEntityTypeConfiguration : IEntityTypeConfiguration
where TBase : BaseEntity
{
public virtual void Configure(EntityTypeBuilder entityTypeBuilder)
{
//Base Configuration
}
}
public class MaintainerConfiguration : BaseEntityTypeConfiguration
{
public override void Configure(EntityTypeBuilder entityTypeBuilder)
{
entityTypeBuilder.Property(b => b.CreatedDateUtc).HasDefaultValueSql("CURRENT_TIMESTAMP");
base.Configure(entityTypeBuilder);
}
}