Database creates (entity framework)

This commit is contained in:
2020-01-22 20:30:40 +01:00
parent 076d0e94d4
commit 137417fde8
9 changed files with 73 additions and 8 deletions

View File

@ -7,7 +7,7 @@ using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
namespace test
namespace EntityFrameworkBasics
{
public class Startup
{
@ -21,6 +21,11 @@ namespace test
// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
{
using(var context = new ApplicationDBContext())
{
context.Database.EnsureCreated();
}
services.AddMvc();
}