// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env, EFDemoContexto context) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); app.UseBrowserLink(); } else { app.UseExceptionHandler("/Home/Error"); } app.UseStaticFiles(); app.UseMvc(routes => { routes.MapRoute( name: "default", template: "{controller=Home}/{action=Index}/{id?}"); }); context.Database.EnsureDeleted(); context.Database.EnsureCreated(); var age = new Random(); A.Configure <Artista>() .Fill(i => i.Idade).WithinRange(18, 60) .Fill(n => n.Nome).AsFirstName() .Fill(s => s.Sobrenome).WithRandom(new[] { "Silva", "Maria", "Paulo" }); var artistas = GenFu.GenFu.ListOf <Artista>(800); context.Artistas.AddRange(artistas); context.SaveChanges(); }
public ArtistaController(EFDemoContexto contexto) { _contexto = contexto; }