Reusing a column for a required property with Entity Framework 6.0, Fluent API, and DataAnnotations
问题 I have a base class public class BaseClass { public int Id {get; set;} } and two derived classes public class Foobar: BaseClass { [Required] public int Whatever {get; set;} } public class Snafu: BaseClass { [Required] public int Whatever {get; set;} } I'm using Table Per Hierarchy inheritance and trying to cut down on my duplicate columns, so with Fluent API I've mapped them like so: modelBuilder.Entity<Foobar>().Property(fb => fb.Whatever).HasColumnName("Whatever"); modelBuilder.Entity<Snafu