-
0 votesanswersviews
在Entity Framework Table-Per-Type中创建派生类型
基本上,我在TPT架构中有两个EF类(映射到数据库): // Gets mapped to a table called "People". public class Person { public Guid Id { get; set; } } // Gets mapped to a table called "People_Student". publi... -
17 votesanswersviews
继承和复合外键 - 基类中键的一部分,派生类中的另一部分
我在为以下示例数据库模式(在SQL Server中)创建实体框架代码优先映射时遇到问题: 每个表都包含 TenantId ,它是所有(复合)主键和外键(多租户)的一部分 . Company 是 Customer 或 Supplier ,我尝试通过Table-Per-Type(TPT)继承映射对此进行建模: public abstract class Company { public in... -
2 votesanswersviews
首先在实体框架代码中继承TPT
通过在 Entity Framework codefirst 中使用 Table per Type (TPT) 继承,我们可以像这样创建外键: public abstract class Person { public int id { get; set; } public string Name { get; set; } public string Family ...