Esempio n. 1
0
 public override void InsertMany(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();
     }
 }
Esempio n. 2
0
 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;
 }