public static async Task Initialize(OneDbContext context, UserManager <UserOne> userManager, RoleManager <RoleOne> roleManager, IConfiguration configuration) { context.Database.EnsureCreated(); // the idea is that we want to make sure that everytime app is run, // there will always be a backend-admin-account belong to backend-admin-role // await CreateBackendAdminRoleAndUser(userManager, roleManager, configuration); }
public MainFramesView(IEnumerable <CategoryModel> newCollection) { InitializeComponent(); //collCategories = new ObservableCollection<CategoryModel>(); _isNew = true; Context = new OneDbContext(_isNew); Context.dbCategory.AddRange(newCollection); Context.SaveChanges(); Context.dbCategory.Load(); _windowDbView = new FrameDbView(Context.dbCategory.Local); this.MainFrame.NavigationService.Navigate(_windowDbView); }
public MainFramesView(string mdfFilename) { InitializeComponent(); Context = new OneDbContext(mdfFilename); try { Context.dbCategory.Include(c => c.Keys).Include(c => c.S7Items).Include(c => c.Db).Load(); Context.dbSymbolTableItem.Include(i => i.PeripheryCode).Load(); var n = new SymbolTableItemModel(); } catch (Exception ex) { MessageBox.Show("Database load error: " + ex.Message.ToString()); } _windowDbView = new FrameDbView(Context.dbCategory.Local); this.MainFrame.NavigationService.Navigate(_windowDbView); }