EF6 -> 映射所有非公有的屬性
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
modelBuilder.Types().Configure(d =>
{
var nonPublicProperties = d.ClrType.GetProperties(BindingFlags.NonPublic | BindingFlags.Instance);
foreach (var p in nonPublicProperties)
{
d.Property(p).HasColumnName(p.Name);
}
});
base.OnModelCreating(modelBuilder);
}