Database creates (entity framework)
This commit is contained in:
@ -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();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user