I added this in my dbcontext. It is supposed to create the database but it doesnt.. what i am doing wrong ? Is’nt CreateDatabaseIfNotExists supposed to create the database once the context is created ?
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
modelBuilder.Configurations.Add(new ProjectConfiguration());
Database.SetInitializer<PfsContext>(new CreateDatabaseIfNotExists<PfsContext>());
base.OnModelCreating(modelBuilder);
}
Database initializer will not create the database once you create the context. It should created the database once you use the context for date retrieval (execute query) or data persistence (save changes). You can also trigger creation manually: