📜  实体框架插入 - C# 代码示例

📅  最后修改于: 2022-03-11 14:48:41.083000             🧑  作者: Mango

代码示例1
var id = Guid.NewGuid();

 // insert
 using (var db = new EfContext("name=EfSample"))
 {
    var customers = db.Set();
    customers.Add( new Customer { CustomerId = id, Name = "John Doe" } );

    db.SaveChanges();
 }