Exemplo n.º 1
0
        // This method gets called by the runtime. Use this method to add services to the container.
        // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddRazorPages();
            services.AddServerSideBlazor();
            FurnitureContextFactory furniture = new FurnitureContextFactory(Configuration.GetConnectionString(_keyConnection));

            MigrateDataBase(furniture);
            services.AddSingleton(furniture);
            services.AddScoped <FurnitureRepository>();
            services.AddScoped <FurnitureService>();
        }
Exemplo n.º 2
0
 private void MigrateDataBase(FurnitureContextFactory furniture)
 {
     using var context = furniture.CreateDbContext(new[] { string.Empty });
     context.MigrateDb();
 }