I have column, columnA, and columnB models. I am trying to override the" protected override void OnModelCreating(ModelBuilder modelBuilder)" method and trying to implement backing fields.
public class Column<TKey> : AuditableModel<TKey>
where TKey: IComparable
{
public string Name { get; set; }
[Required]
public Settings Settings {get;,set;} = new Settings();
}
public class ColumnA : Column<Guid>
{
public Guid Id { get; set; }
}
public class ColumnB : Column<Guid>
{
public Guid Id { get; set; }
}
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.Entity<ColumnA>()
.Property(x => x.Settings)
modelBuilder.Entity<ColumnB>()
.Property(x => x.Settings)
}
How can I use a "Column" type for backing fields instead of doing this separately for a ColumnA and columnB (on a modelCreating method)?
IEntityTypeConfiguration<T>classes, and then register them inOnModelCreating(...)withmodelBuilder.ApplyConfigurationsFromAssembly(assembly);. - Gup3rSuR4c