Example for MVC4 and dotConnect for Postgres

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for PostgreSQL
Post Reply
snielsson
Posts: 3
Joined: Thu 27 Sep 2012 10:47

Example for MVC4 and dotConnect for Postgres

Post by 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? ... C+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?

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Re: Example for MVC4 and dotConnect for Postgres

Post by 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/enti ... plate.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/enti ... qlite.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.

Post Reply