public static void Initialize(ArchitectDbContext context) { context.Database.EnsureCreated(); // Look for any movies if (context.Customers.Any()) { return; } context.Customers.AddRange( new Customer { FirstName = "Kurt", LastName = "Van de gaer" }, new Customer { FirstName = "Erik", LastName = "Kaes" }, new Customer { FirstName = "Philippe", LastName = "Kenens" }, new Customer { FirstName = "Petra", LastName = "Luyten" } ); context.SaveChanges(); }
public static void Seed(ArchitectDbContext dbContext) { dbContext.Add(new User() { FirstName = "Name", LastName = "Surname", Username = "******", Password = "******" }); dbContext.Add(new Record() { Description = "Record 1" }); dbContext.SaveChanges(); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env, ArchitectDbContext context) { if (env.IsDevelopment()) { app.UseBrowserLink(); app.UseDeveloperExceptionPage(); } else { app.UseExceptionHandler("/Home/Error"); } app.UseStaticFiles(); app.UseMvc(routes => { routes.MapRoute( name: "default", template: "{controller=Home}/{action=Index}/{id?}"); }); DbInitializer.Initialize(context); }
public CustomersController(ArchitectDbContext context) { _context = context; }
public RepositoryUnit(ArchitectDbContext dbContext) => DbContext = dbContext;
public RecordRepository(ArchitectDbContext dbContext) : base(dbContext) { }
protected Repository(ArchitectDbContext dbContext) => DbContext = dbContext;
public UserRepository(ArchitectDbContext dbContext) : base(dbContext) { }