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
相關文章
相關標籤/搜索