public override void SeedContext(RioValleyChiliDataContext newContext) { new ProductsDbContextDataSeeder().SeedContext(newContext); var consoleTicker = new ConsoleTicker(); using (var oldContext = ContextsHelper.GetOldContext()) { var proxyCreation = newContext.Configuration.ProxyCreationEnabled; var autoDetectChangesEnabled = newContext.Configuration.AutoDetectChangesEnabled; var lazyLoading = newContext.Configuration.LazyLoadingEnabled; try { newContext.Configuration.ProxyCreationEnabled = false; newContext.Configuration.AutoDetectChangesEnabled = false; newContext.Configuration.LazyLoadingEnabled = false; oldContext.CommandTimeout = 1800; LoadLots(newContext, oldContext, consoleTicker); LoadLotAttributeHistory(newContext, oldContext, consoleTicker); LoadInventory(newContext, oldContext, consoleTicker); LoadInventoryAdjustments(newContext, oldContext, consoleTicker); } finally { newContext.Configuration.ProxyCreationEnabled = proxyCreation; newContext.Configuration.AutoDetectChangesEnabled = autoDetectChangesEnabled; newContext.Configuration.LazyLoadingEnabled = lazyLoading; } } }
public override void SeedContext(RioValleyChiliDataContext newContext) { new OrderDbContextDataSeeder().SeedContext(newContext); var consoleTicker = new ConsoleTicker(); using (var oldContext = ContextsHelper.GetOldContext()) { var proxyCreation = newContext.Configuration.ProxyCreationEnabled; var autoDetectChangesEnabled = newContext.Configuration.AutoDetectChangesEnabled; var lazyLoading = newContext.Configuration.LazyLoadingEnabled; try { newContext.Configuration.ProxyCreationEnabled = false; newContext.Configuration.AutoDetectChangesEnabled = true; newContext.Configuration.LazyLoadingEnabled = false; oldContext.CommandTimeout = 1200; LoadInventoryTransactions(oldContext, newContext, consoleTicker); } finally { newContext.Configuration.ProxyCreationEnabled = proxyCreation; newContext.Configuration.AutoDetectChangesEnabled = autoDetectChangesEnabled; newContext.Configuration.LazyLoadingEnabled = lazyLoading; } } }
public override void SeedContext(RioValleyChiliDataContext newContext) { new CompanyDbContactDataSeeder().SeedContext(newContext); var consoleTicker = new ConsoleTicker(); using (var oldContext = ContextsHelper.GetOldContext()) { var proxyCreation = newContext.Configuration.ProxyCreationEnabled; var autoDetecChanges = newContext.Configuration.AutoDetectChangesEnabled; var lazyLoading = newContext.Configuration.LazyLoadingEnabled; try { newContext.Configuration.ProxyCreationEnabled = false; newContext.Configuration.AutoDetectChangesEnabled = false; newContext.Configuration.LazyLoadingEnabled = false; Console.WriteLine("Loading Products"); var chileProducts = LoadProducts(newContext, new ChileProductEntityObjectMother(oldContext, newContext, RVCDataLoadLoggerGate.ChileProductLoadLoggerCallback), consoleTicker, "\tChile Products", c => c.Product); LoadRecords(newContext, chileProducts.SelectMany(c => c.ProductAttributeRanges), "\t\tproduct attribute ranges", consoleTicker); LoadRecords(newContext, new ChileProductIngredientsMother(oldContext, newContext, RVCDataLoadLoggerGate.ChileProductIngredientsLoadLoggerCallback), "\t\tingredients", consoleTicker); LoadProducts(newContext, new PackagingProductEntityObjectMother(oldContext, newContext, RVCDataLoadLoggerGate.PackagingProductLoadLoggerCallback), consoleTicker, "\tPackaging Products", p => p.Product); LoadProducts(newContext, new AdditiveProductEntityObjectMother(oldContext, newContext, RVCDataLoadLoggerGate.AdditiveProductLoadLoggerCallback), consoleTicker, "\tAdditive Products", a => a.Product); LoadProducts(newContext, new NonInventoryProductEntityObjectMother(oldContext, newContext, RVCDataLoadLoggerGate.NonInventoryProductLoadLoggerCallback), consoleTicker, "\tNon-Inventory Products"); StartWatch(); var specs = new List <CustomerProductAttributeRange>(); ProcessedBirth(new CustomerProductSpecMother(oldContext, newContext, RVCDataLoadLoggerGate.CustomerSpecsLoadLoggerCallback), "Loading Customer Product Specs", consoleTicker, specs.Add); consoleTicker.ReplaceCurrentLine("Loading Customer Product Specs"); LoadRecords(newContext, specs, "\tcustomer product attribute ranges", consoleTicker); consoleTicker.WriteTimeElapsed(StopWatch()); StartWatch(); var codes = new List <CustomerProductCode>(); ProcessedBirth(new CustomerProductCodeMother(oldContext, newContext, RVCDataLoadLoggerGate.CustomerProductCodeLoadLoggerCallback), "Loading Customer Product Codes", consoleTicker, codes.Add); consoleTicker.ReplaceCurrentLine("Loading Customer Product Codes"); LoadRecords(newContext, codes, "\tcustomer product codes", consoleTicker); consoleTicker.WriteTimeElapsed(StopWatch()); oldContext.ClearContext(); } finally { newContext.Configuration.ProxyCreationEnabled = proxyCreation; newContext.Configuration.AutoDetectChangesEnabled = autoDetecChanges; newContext.Configuration.LazyLoadingEnabled = lazyLoading; } } }
public override void SeedContext(RioValleyChiliDataContext newContext) { var consoleTicker = new ConsoleTicker(); using (var oldContext = ContextsHelper.GetOldContext()) { InitializeOldContext(); var proxyCreation = newContext.Configuration.ProxyCreationEnabled; var autoDetecChanges = newContext.Configuration.AutoDetectChangesEnabled; var lazyLoading = newContext.Configuration.LazyLoadingEnabled; try { newContext.Configuration.ProxyCreationEnabled = false; newContext.Configuration.AutoDetectChangesEnabled = false; newContext.Configuration.LazyLoadingEnabled = false; CreateOldContextRecords(oldContext); LoadRecords(newContext, new EmployeeObjectMother(oldContext, RVCDataLoadLoggerGate.EmployeeLoadLoggerCallback), "Loading Employees", consoleTicker); LoadRecords(newContext, new NotebookMother(RVCDataLoadLoggerGate.LogSummaryEntry("Notebooks")), "Loading Notebooks", consoleTicker); LoadRecords(newContext, new ChileTypeMother(), "Loading Chile Types", consoleTicker); LoadRecords(newContext, new AdditiveTypeMother(), "Loading Additive Types", consoleTicker); LoadRecords(newContext, new WorkTypeMother(), "Loading Work Types", consoleTicker); LoadRecords(newContext, new AttributeNameMother(RVCDataLoadLoggerGate.LogSummaryEntry("Attribute Names")), "Loading Attribute Names", consoleTicker); LoadRecords(newContext, new InventoryTreatmentMother(oldContext, RVCDataLoadLoggerGate.InventoryTreatmentLoadLoggerCallback), "Loading Inventory Treatment Types", consoleTicker); LoadRecords(newContext, new InventoryTreatmentForAttributeMother(), "Loading inventory treatment valdiation rules", consoleTicker); var message = "Loading Facilities"; var facilities = new FacilityEntityObjectMother(oldContext, newContext, RVCDataLoadLoggerGate.WarehouseLoadLoggerCallback).BirthAll(() => consoleTicker.TickConsole(message + "...")).ToList(); consoleTicker.ReplaceCurrentLine(message); LoadRecords(newContext, facilities, "\tfacilities", consoleTicker); LoadRecords(newContext, facilities.SelectMany(w => w.Locations), "\tlocations", consoleTicker); oldContext.ClearContext(); } finally { newContext.Configuration.ProxyCreationEnabled = proxyCreation; newContext.Configuration.AutoDetectChangesEnabled = autoDetecChanges; newContext.Configuration.LazyLoadingEnabled = lazyLoading; } } }
public override void SeedContext(RioValleyChiliDataContext newContext) { new ProductionDataSeeder().SeedContext(newContext); var consoleTicker = new ConsoleTicker(); using (var oldContext = ContextsHelper.GetOldContext()) { var proxyCreation = newContext.Configuration.ProxyCreationEnabled; var autoDetectChangesEnabled = newContext.Configuration.AutoDetectChangesEnabled; var lazyLoading = newContext.Configuration.LazyLoadingEnabled; try { newContext.Configuration.ProxyCreationEnabled = false; newContext.Configuration.AutoDetectChangesEnabled = true; newContext.Configuration.LazyLoadingEnabled = false; newContext.Configuration.UseDatabaseNullSemantics = true; oldContext.CommandTimeout = 1800; LoadContracts(oldContext, newContext, consoleTicker); LoadSalesOrders(oldContext, newContext, consoleTicker); LoadTreatmentOrders(oldContext, newContext, consoleTicker); LoadInterWarehouseOrders(oldContext, newContext, consoleTicker); LoadIntraWarehouserOrders(oldContext, newContext, consoleTicker); LoadLotAllowances(oldContext, newContext, consoleTicker); LoadSampleOrders(oldContext, newContext, consoleTicker); LoadSalesQuotes(oldContext, newContext, consoleTicker); } finally { newContext.Configuration.ProxyCreationEnabled = proxyCreation; newContext.Configuration.AutoDetectChangesEnabled = autoDetectChangesEnabled; newContext.Configuration.LazyLoadingEnabled = lazyLoading; } } }
public override void SeedContext(RioValleyChiliDataContext newContext) { new CoreDbContextDataSeeder().SeedContext(newContext); var consoleTicker = new ConsoleTicker(); using (var oldContext = ContextsHelper.GetOldContext()) { var companyResults = new CompanyAndContactsMother(oldContext, newContext, RVCDataLoadLoggerGate.CompanyAndContactsLoadLoggerCallback).BirthAll(() => consoleTicker.TickConsole("Loading Companies...")).ToList(); consoleTicker.ReplaceCurrentLine("Loading Companies"); var companies = new List <Models.Company>(); var contacts = new List <Models.Contact>(); var contactAddresses = new List <ContactAddress>(); var customers = new List <Customer>(); var customerNotes = new List <CustomerNote>(); foreach (var result in companyResults) { companies.Add(result.Company); contacts.AddRange(result.Company.Contacts); contactAddresses.AddRange(result.Company.Contacts.SelectMany(c => c.Addresses)); if (result.Customer != null) { customers.Add(result.Customer); customerNotes.AddRange(result.Customer.Notes); } } LoadRecords(newContext, companies, "\tcompanies", consoleTicker); LoadRecords(newContext, companies.SelectMany(c => c.CompanyTypes), "\tcompany types", consoleTicker); LoadRecords(newContext, contacts, "\tcontacts", consoleTicker); LoadRecords(newContext, contactAddresses, "\tcontact addresses", consoleTicker); LoadRecords(newContext, customers, "\tcustomers", consoleTicker); LoadRecords(newContext, customerNotes, "\tcustomer notes", consoleTicker); } }
public override void SeedContext(RioValleyChiliDataContext newContext) { new InventoryDbContextDataSeeder().SeedContext(newContext); var consoleTicker = new ConsoleTicker(); using (var oldContext = ContextsHelper.GetOldContext()) { var proxyCreation = newContext.Configuration.ProxyCreationEnabled; var autoDetectChangesEnabled = newContext.Configuration.AutoDetectChangesEnabled; var lazyLoading = newContext.Configuration.LazyLoadingEnabled; try { newContext.Configuration.ProxyCreationEnabled = false; newContext.Configuration.AutoDetectChangesEnabled = true; newContext.Configuration.LazyLoadingEnabled = false; oldContext.CommandTimeout = 2400; oldContext.ClearContext(); LoadPackSchedules(oldContext, newContext, consoleTicker); LoadProductionBatches(oldContext, newContext, consoleTicker); LoadProductionSchedules(oldContext, newContext, consoleTicker); LoadInstructions(oldContext, newContext, consoleTicker); LoadChileMaterialsReceived(oldContext, newContext, consoleTicker); LoadMillAndWetdown(oldContext, newContext, consoleTicker); } finally { newContext.Configuration.ProxyCreationEnabled = proxyCreation; newContext.Configuration.AutoDetectChangesEnabled = autoDetectChangesEnabled; newContext.Configuration.LazyLoadingEnabled = lazyLoading; } } }