Пример #1
0
 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);
 }
Пример #2
0
        static void Main(string[] args)
        {
            IEnumerable <CallCenter> collection = new List <CallCenter>();

            using (var dbContext = new CallsContext())
            {
                collection = dbContext.CallCenters.ToArray();
            }
        }
Пример #3
0
        private void ParseAndInstertData(CallsContext context)
        {
            foreach (var client in GetClients())
            {
                context.Clients.Add(client);
            }

            foreach (var manager in GetManagers())
            {
                context.Managers.Add(manager);
            }
        }
Пример #4
0
        public void Init()
        {
            using (var context = new CallsContext())
            {
                context.Configuration.AutoDetectChangesEnabled = false;

                ClearDataBase(context);
                CreateCallCenters(context);
                ParseAndInstertData(context);

                context.ChangeTracker.DetectChanges();
                context.SaveChanges();
            }
        }
Пример #5
0
 private void ClearDataBase(CallsContext context)
 {
     context.Database.Delete();
 }