Entity Framework(七):Fluent API配置案例

一、配置主键 要显式将某个属性设置为主键,可使用 HasKey 方法。在以下示例中,使用了 HasKey 方法对 Product 类型配置 ProductId 主键。 1、新加Product类 1 using System; 2 using System.Collections.Generic; 3 using System.Linq; 4 using System.Text; 5 us
相关文章
相关标签/搜索