private void generateClients() { for (var i = 0; i < 500; i++) { using (var context = new EfContext()) { context.Configuration.AutoDetectChangesEnabled = false; context.Configuration.ValidateOnSaveEnabled = false; for (var j = 0; j < 1000; j++) { var client = new Client { Name = "client" + i + "_" + j, Changed = DateTime.Now, CategoryId = ((j*3 + j/7)%100) + 1, GroupId = ((j*5 + j/11)%100) + 1 }; context.Entry(client).State = EntityState.Added; } context.SaveChanges(); } } }
private void generateGroups() { using (var context = new EfContext()) { context.Configuration.AutoDetectChangesEnabled = false; context.Configuration.ValidateOnSaveEnabled = false; for (int i = 0; i < 100; i++) { var group = new RiskGroup {Name = "group" + i}; context.Entry(group).State = EntityState.Added; } context.SaveChanges(); } }
private void generateCategories() { using (var context = new EfContext()) { context.Configuration.AutoDetectChangesEnabled = false; context.Configuration.ValidateOnSaveEnabled = false; for (int i = 0; i < 100; i++) { var category = new Category { Name = "category" + i }; context.Entry(category).State = EntityState.Added; } context.SaveChanges(); } }