Пример #1
0
 protected void addObjectToDBSet_Insert <NameClass>(ref ConnectionEFDataFirst context, ref DbSet <NameClass> dbSetObject, List <NameClass> lsObject) where NameClass : class
 {
     if (lsObject != null && lsObject.Count > 0)
     {
         foreach (NameClass item in lsObject)
         {
             dbSetObject.Add(item);
         }
     }
 }
Пример #2
0
 protected void addObjectToDBSet_Update <NameClass>(ref ConnectionEFDataFirst context, ref DbSet <NameClass> dbSetObject, List <NameClass> lsObject) where NameClass : class
 {
     if (lsObject != null && lsObject.Count > 0)
     {
         foreach (NameClass item in lsObject)
         {
             dbSetObject.Add(item);
             context.Entry((object)item).State = EntityState.Modified;
         }
     }
 }
Пример #3
0
 protected void deleteListObject <NameClass>(ref ConnectionEFDataFirst context, ref DbSet <NameClass> dbSetObject, List <NameClass> lsObject) where NameClass : class
 {
     if (lsObject != null && lsObject.Count > 0)
     {
         foreach (NameClass item in lsObject)
         {
             dbSetObject.Attach(item);
             dbSetObject.Remove(item);
         }
     }
 }