Example for MVC4 and dotConnect for Postgres

Example for MVC4 and dotConnect for Postgres

Postby snielsson » Thu 27 Sep 2012 10:58

Hello

Where can I find a step-by-step tutorial on how to do an ASP.NET MVC4 internet application with Entity Framework 5 and dotConnector for Postgresql? Assuming I use the default internet application project temaplte for ASP.NET MVC4 in VS2012 I would like to see:

1) What devart assemblies to refrence
2) How to set the connection string
3) How to add a model with EF5 codefirst
4) How to change the model and then use EF migrations to update the postgresql database

I have seen this:
http://forums.devart.com/viewtopic.php?f=2&t=24826&p=84196&hilit=MVC+4#p84196
but this does not really answer anything

Right now I have made a new MVC4 application in VS2012 that works with localdb (can register a new user and login) and I have installed dotConnector (and I can connect to my local postgres server from within VS2012) but what do I do next to switch the application over to use Postgresql?
snielsson
 
Posts: 3
Joined: Thu 27 Sep 2012 10:47

Re: Example for MVC4 and dotConnect for Postgres

Postby Shalex » Thu 04 Oct 2012 10:43

snielsson wrote:3) How to add a model with EF5 codefirst

Entity Developer (*.edml, the Devart Entity Model item in VS) includes the DbContext template which allows using fluent mapping not only in the Code-First approach, but in the Database-First/Model-First approaches as well: http://blogs.devart.com/dotconnect/entity-developer-ef-code-first-dbcontext-template.html.

snielsson wrote:4) How to change the model and then use EF migrations to update the postgresql database

Our blog article contains the reference to general tutorials in MSDN and tells the exact settings which should be employed in case of using Devart dotConnect providers: http://blogs.devart.com/dotconnect/entity-framework-code-first-migrations-support-for-oracle-mysql-postgresql-and-sqlite.html .

So we recommend you to generate a context (descendant of DbContext) with the DbContext template and then apply EF migrations to the generated classes.
Shalex
Devart Team
 
Posts: 7774
Joined: Thu 14 Aug 2008 12:44


Return to dotConnect for PostgreSQL