public override void CleanupTestDataSet() { using (var dataContext = new EF6Context()) { dataContext.Database.Connection.Open(); dataContext.Entities.RemoveRange(dataContext.Entities.ToList()); dataContext.SaveChanges(); } }
public override void CreateTestDataSet(int recordsCount) { CleanupTestDataSet(); EF6Entity[] data = new EF6Entity[recordsCount]; for (int i = 0; i < recordsCount; i++) { data[i] = new EF6Entity() { Id = i, Value = i }; } using (var dataContext = new EF6Context()) { dataContext.Database.Connection.Open(); dataContext.Entities.AddRange(data); dataContext.SaveChanges(); } RecordsCount = recordsCount; }
public override void InsertOne(int recordsCount) { using (var transaction = dataContext.Database.BeginTransaction()) { for (int i = 0; i < recordsCount; i++) { var item = new EF6Entity() { Id = i, Value = i }; dataContext.Entities.Add(item); dataContext.SaveChanges(); } transaction.Commit(); } }