I'm trying to map two entities to the same table with the same columns. The differences are HasQueryFilter condition for every entity and a column that takes part in the reference. The entities describe ralationship between dictionary and entity. When I launch it, I receive the following message: "... both mapped to column '' in '' but are configured with different nullability."
public class KeyValuesEntity : BaseEntity
{
[Column("keyalphanr")]
[StringLength(255)]
public string keyalphanumber { get; set; }
[Column("keydesc")]
[StringLength(255)]
public string keydescription { get; set; }
[Column("keyvalint")]
public int? keyvalueint { get; set; }
}
[Table("keyval")]
public class KeyValuesBaseEntity : BaseEntity
{
[Column("keyalphanr")]
[StringLength(255)]
public string keyalphanumber { get; set; }
[Column("keydesc")]
[StringLength(255)]
public string keydescription { get; set; }
[Column("keyvalint")]
public int? keyvalueint { get; set; }
protected KeyValuesBaseEntity()
{
}
}
public sealed class OptionsEntity : KeyValuesBaseEntity
{
}
var lboptionsBuilder = modelBuilder.Entity<LBOptionsEntity>();
lboptionsBuilder.HasOne(lboptions => lboptions.optionholderKeyValue)
.WithOne()
.HasForeignKey<LBOptionsEntity>(lboptions => lboptions.optionholder)
.HasPrincipalKey<OptionsEntity>(keyval => keyval.keyalphanumber);