I'm trying to EF Core 1.0 with PostgreSQL with ASP.NET Core project, Here is my context class:
public class ApplicationDbContext : DbContext
{
public ApplicationDbContext(DbContextOptions<ApplicationDbContext> options)
:base(options)
{
}
public DbSet<Person> People { get; set; }
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
base.OnConfiguring(optionsBuilder);
}
}
I'm added the following packages:
"dependencies": {
"Microsoft.NETCore.App": {
"type": "platform",
"version": "1.0.0"
},
"Microsoft.EntityFrameworkCore": "1.0.0",
"Npgsql.EntityFrameworkCore.PostgreSQL": "1.0.0",
"Microsoft.EntityFrameworkCore.Design": "1.0.0-preview2-final"
},
I've registered in Startup.cs as:
public void ConfigureServices(IServiceCollection services)
{
services.AddEntityFrameworkNpgsql()
.AddDbContext<ApplicationDbContext>(options => options.UseNpgsql("User ID=postgres;Password=;Server=localhost;Port=1234;Database=ApplicationDbContext;Pooling=true;"));
services.AddMvc();
}
Now when I try to add a migration as dotnet ef migrations add InitialMigrations, I get a successful migration message. But when I connect to the server in pgAdmin, I do not see any newly created database whats wrong, where I'm going things wrong?
Please also provide a link of 1-1 for using PostgreSQL with EFCore if you have any.
Startup.cs?