Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何使用 Code First 方法在 Entity Framework 5 中进行手动表映射?
我所说的表映射是将数据库中的表名关联到具有不同名称的实体类。
这很简单。
[Table("Foo")] public class Bar { // properties }
对于流利的 api:
protected override void OnModelCreating(DbModelBuilder modelBuilder) { modelBuilder.Entity<MyEntity>().ToTable("MyTargetTable"); }