private void CreateCallCenters(CallsContext context) { callCentersId = new Dictionary <int, CallCenter>(8); for (var i = 1; i < 9; i++) { callCentersId[i] = new CallCenter(i); } context.CallCenters.AddRange(callCentersId.Values); }
static void Main(string[] args) { IEnumerable <CallCenter> collection = new List <CallCenter>(); using (var dbContext = new CallsContext()) { collection = dbContext.CallCenters.ToArray(); } }
private void ParseAndInstertData(CallsContext context) { foreach (var client in GetClients()) { context.Clients.Add(client); } foreach (var manager in GetManagers()) { context.Managers.Add(manager); } }
public void Init() { using (var context = new CallsContext()) { context.Configuration.AutoDetectChangesEnabled = false; ClearDataBase(context); CreateCallCenters(context); ParseAndInstertData(context); context.ChangeTracker.DetectChanges(); context.SaveChanges(); } }
private void ClearDataBase(CallsContext context) { context.Database.Delete(); }