public void TestMethod1() { var dbcount = new erpEntities(); var a = new stockapplydetails() { Apddemanddate = DateTime.Now, Apdintomoney = 999, Apdmateridlid = "A01", Apdmateridlname = "物料mingz", Apdmodel = "", Apdnotnum = 10, Apdnum = 10, Apdoriginid = "", Apdorigintype = "", Apdprice = 999, Apdremark = "备注", Apdstandardmoney = 999, Apdstandardprice = 999, Apdstockdate = DateTime.Now, Apdunit = "个", Appid = "A01", Enables = 1, TockapplyDetails = "001" }; dbcount.stockapplydetails.Add(a); int count = dbcount.SaveChanges(); }
public virtual void Remove(params T[] items) { using (var context = new erpEntities()) { foreach (T item in items) { context.Entry(item).State = System.Data.Entity.EntityState.Deleted; } context.SaveChanges(); context.Dispose(); } }