Configuring EF and Npgsql for code first Configuring EF and Npgsql for code first postgresql postgresql

Configuring EF and Npgsql for code first


Your context doesn't appear to be using your connection string. Do that with the constructor on your context:

public class BloggingEntities : DbContext{    public BloggingEntities()        : base("PostgresDotNet") { }    public DbSet<Blog> Blogs { get; set; }    public DbSet<Post> Posts { get; set; }    protected override void OnModelCreating(DbModelBuilder modelBuilder)    {        // PostgreSQL uses the public schema by default - not dbo.        modelBuilder.HasDefaultSchema("public");        base.OnModelCreating(modelBuilder);    }}   

http://fdevel.blogspot.com/2013/12/npgsql-with-entity-framework-6.html