コード例 #1
0
 public virtual void Delete(params T[] items)
 {
     using (var context = new CognizantContext())
     {
         foreach (T item in items)
         {
             context.Entry(item).State = EntityState.Deleted;
         }
         context.SaveChanges();
     }
 }
コード例 #2
0
 public virtual void AddNoValidate(params T[] items)
 {
     using (var context = new CognizantContext())
     {
         foreach (T item in items)
         {
             context.Entry(item).State = EntityState.Added;
         }
         context.Configuration.ValidateOnSaveEnabled = false;
         context.SaveChanges();
     }
 }