Esempio n. 1
0
 /// <summary>
 /// Add to the PimsContext 'context' with the specified data in 'entities'.
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <param name="context"></param>
 /// <param name="entities"></param>
 /// <returns></returns>
 public static PimsContext AddAndSaveRange <T>(this PimsContext context, IEnumerable <T> entities)
     where T : class
 {
     context.Set <T>().AddRange(entities);
     context.SaveChanges();
     return(context);
 }
Esempio n. 2
0
 /// <summary>
 /// Add to the PimsContext 'context' with the specified data in 'entities'.
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <param name="context"></param>
 /// <param name="entity"></param>
 /// <returns></returns>
 public static PimsContext AddAndSaveChanges <T>(this PimsContext context, params T[] entity)
     where T : class
 {
     context.Set <T>().AddRange(entity);
     context.SaveChanges();
     return(context);
 }