Print Page | Close Window

Code first PostgreSql

Printed From: IdeaBlade
Category: DevForce
Forum Name: DevForce 2010
Forum Discription: For .NET 4.0
URL: http://www.ideablade.com/forum/forum_posts.asp?TID=3315
Printed Date: 13-May-2026 at 7:58am


Topic: Code first PostgreSql
Posted By: Thomas
Subject: Code first PostgreSql
Date Posted: 04-Mar-2012 at 6:34am
I tried to use your model first WPF tutorial application and when i changed the connection string to 

<add name="CodeFirstWalk" connectionString="User Id=postgres;Host=localhost;Database=postgres;Persist Security Info=True;Schema='&quot;ETERADEV&quot;'" providerName="Devart.Data.PostgreSql" />

I got 

An error occurred during metadata generation and a metadata file could not be created.  Error: Keyword not supported: 'host'. G:\Program Files (x86)\MSBuild\IdeaBlade\IdeaBlade.DevForce.Common.targets 110 5


If you want to try it out just install the Devart PostgreSql provider and change the string.



Replies:
Posted By: sbelini
Date Posted: 05-Mar-2012 at 5:10pm
Hi Thomas,
 
I'm confused. Are you using ModelFirst or CodeFirst?
 
When you create an edmx based on an existing PostgreSql DB, what does the connectionSting look like?
 
Regards,
   Silvio.


Posted By: Thomas
Date Posted: 05-Mar-2012 at 9:50pm
Connection string for model first:

connectionString="metadata=res://*/model.EBModel.csdl|res://*/model.EBModel.ssdl|res://*/model.EBModel.msl;provider=Devart.Data.PostgreSql;provider connection string=&quot;User Id=postgres;Host=localhost;Database=postgres;Persist Security Info=True;Schema='&quot;&quot;ETERADEV&quot;&quot;'&quot;" providerName="System.Data.EntityClient"

And when I get the error I am using CodeFirst (ModelFirst is working).

I get the error when I compile the solution with an included .CF file (as I said, you can try it if you modify the demo WPF CodeFirst to use the devart provider instead of SqlServer)


Posted By: sbelini
Date Posted: 07-Mar-2012 at 2:02pm
Hi Thomas,
 
You will need to set the DefaultConnectionFactory. We talk about this topic in the http://drc.ideablade.com/xwiki/bin/view/Documentation/code-first-sqlce#HSettheDefaultConnectionFactory - DevForce Resource Center .
 
For PostgresSQL/Devart specifically, you might want to take a look at: http://www.devart.com/blogs/dotconnect/index.php/using-entity-framework-power-tools-ctp1-with-oracle-mysql-postgresql-and-sqlite.html#using - http://www.devart.com/blogs/dotconnect/index.php/using-entity-framework-power-tools-ctp1-with-oracle-mysql-postgresql-and-sqlite.html#using .
Be sure to also write an implementation of IDbConnectionFactory. (as shown in the link above)
 
Regards,
   Silvio.



Print Page | Close Window