public void SeedEverything(AccountingDatabaseService context) { context.Database.EnsureDeleted(); context.Database.EnsureCreated(); if (context.AccountType.Any()) { return; // Db has been seeded } SeedAccountType(context); SeedSystemLookup(context); SeedLedgerEntries(context); context.SaveChanges(); }
public void SeedAccountType(AccountingDatabaseService database) { var accountType = new [] { new AccountType() { Id = 10, Type = "Asset", TypeOf = 0 }, new AccountType() { Id = 12, Type = "Liability", TypeOf = 0 }, new AccountType() { Id = 13, Type = "Capital", TypeOf = 0 }, new AccountType() { Id = 14, Type = "Revenue", TypeOf = 0 }, new AccountType() { Id = 15, Type = "Expence", TypeOf = 0, AccountCatagory = new [] { new AccountCatagory() { Id = 2, Catagory = "Cash Account", DateAdded = DateTime.Now, DateUpdated = DateTime.Now }, new AccountCatagory() { Id = 3, Catagory = "COGE", DateAdded = DateTime.Now, DateUpdated = DateTime.Now }, } }, }; database.AccountType.AddRange(accountType); }
public void SeedLedgerEntries(AccountingDatabaseService database) { database.Save(); }
public void SeedSystemLookup(AccountingDatabaseService database) { }
public static void Initialize(AccountingDatabaseService context) { var initializer = new AccountingDatabaseInitializer(); initializer.SeedEverything(context); }