/// <summary> /// Insert a list of entites into the related database table /// </summary> /// <typeparam name="T"></typeparam> /// <param name="insertObjects"></param> public void InsertObjectsIntoDatabase <T>(List <T> insertObjects) where T : Entity { using (MachineModel model = new MachineModel()) { model.Set <T>().AddRange(insertObjects); model.SaveChanges(); } }
/// <summary> /// Delete all entries from one entity type /// </summary> /// <typeparam name="T"></typeparam> public void DeleteAllEntries <T>() where T : Entity { using (MachineModel model = new MachineModel()) { model.Set <T>().RemoveRange(model.Set <T>().ToList()); model.SaveChanges(); } }