We are considering using dotConnect for PostgreSQL. We are using entity framework 6 and are primarily interested in full text search capability outlined in this blog post: http://blog.devart.com/using-postgresql ... ework.html
We are having issues with creating and migrating databases using your provider.
We have the following simple db context:
Code: Select all
namespace DevartConnection
{
public class DevartDbContext : DbContext
{
public virtual DbSet<User> Users { get; set; }
public DevartDbContext(DbConnection connection, bool contextOwnsConnection = true)
: base(connection, contextOwnsConnection)
{
Database.SetInitializer(new CreateDatabaseIfNotExists<DevartDbContext>());
}
public DevartDbContext()
{
}
}
public class User
{
[Key]
public int Id { get; set; }
public string Name { get; set; }
}
}
Code: Select all
namespace DevartConnection
{
class Program
{
static void Main(string[] args)
{
PgSqlConnection connection = new PgSqlConnection
{
Host = "[our host]",
Port = 5433,
Database = "dbthatdoesntexist",
UserId = "[our user id]",
Password = "[our password]",
Schema = "dbo"
};
Console.WriteLine("Connecting to database");
using (var dbContext = new DevartDbContext(connection))
{
dbContext.Users.Add(new User()
{
Id = 1,
Name = "Brad Bow"
});
dbContext.SaveChanges();
}
Console.WriteLine("Successfullly saved item");
Console.ReadLine();
}
}
}
Here is the app.config for the console application.
Code: Select all
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</configSections>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
</startup>
<system.data>
<DbProviderFactories>
<remove invariant="Devart.Data.PostgreSql" />
<add name="dotConnect for PostgreSQL"
invariant="Devart.Data.PostgreSql"
description="Devart dotConnect for PostgreSQL"
type="Devart.Data.PostgreSql.PgSqlProviderFactory, Devart.Data.PostgreSql, Version=7.4.616.0, Culture=neutral, PublicKeyToken=09af7300eec23701" />
</DbProviderFactories>
</system.data>
<entityFramework>
<providers>
<provider invariantName="Devart.Data.PostgreSql" type="Devart.Data.PostgreSql.Entity.PgSqlEntityProviderServices,
Devart.Data.PostgreSql.Entity, Version=7.4.616.6, Culture=neutral, PublicKeyToken=09af7300eec23701" />
</providers>
</entityFramework>
</configuration>
We have added the Devart.Data.PostgreSql.Entity.Migrations dll from C:\Program Files (x86)\Devart\dotConnect\PostgreSQL\Entity\EF5\Devart.Data.PostgreSql.Entity.Migrations.dll as a reference to our console project. We couldn't see an equivalent dll in the EF6 folder, is there supposed to be one there?
Any ideas?
Thanks
Brad