public void MapItem(List <Item> items) { context.Database.BeginTransaction(); context.Database.ExecuteSqlRaw("SET IDENTITY_INSERT Items ON"); context.AddRange(items); context.SaveChanges(); context.Database.ExecuteSqlRaw("SET IDENTITY_INSERT Items OFF;"); context.Database.CommitTransaction(); }