此篇文是 Entity Framework 實戰 - 多對多自我關聯 Many to Many , Self Referencing 模型實作 (一)的續篇 , 當我們把基本模型 Product Class 建立好後,我們開始實作一個繼承 DbContext 的子類別,在這邊你可以把 DbContext 當做是資料庫的層次意義角度來看待
新增一個Class 名為 ProductContext.cs
然後按【新增】按鈕,並在 ProductContext 宣示繼承 DbContext 類別,如以下程式碼
1: using System;
2: using System.Collections.Generic;
3: using System.Data.Entity;
4: using System.Linq;
5: using System.Text;
6: using System.Threading.Tasks;
7:
8: namespace...