static void Main(string[] args) { using (var context = new demoContext()) { var defaultPrimaryKey = "test"; var data = context.Set <item>().Find(defaultPrimaryKey); context.Set <item>().Remove(data); var item1 = new item { ItemGID = defaultPrimaryKey, ItemID = defaultPrimaryKey, TS = DateTime.Now }; context.Set <item>().Add(item1); context.SaveChanges(); } }
public void Delete(T entity) { _context.Set <T>().Remove(entity); }