static void Main(string[] args) { using (var ctx = new MyNoteDbContext()) { ActionType t = new ActionType() { LibelleType = "PaiementFacture" }; ctx.ActionTypes.Add(t); ctx.SaveChanges(); } }
// 使用建構式注入方式,注入MyNoteDbContext 類別執行個體,以便可以存取SQLite 資料庫 public MyNoteDbService(MyNoteDbContext myNoteDbContext) { MyNoteDbContext = myNoteDbContext; }
public MyNoteController(MyNoteDbContext myNoteDbContext) { MyNoteDbContext = myNoteDbContext; }