3

Given the following constraints:

  • I will develop a BRAND NEW website.
  • I will use C# and ASP.NET MVC
  • Linux with mono would be good, but windows is an acceptable constraint (please mention if it is).

Now the interesting bit:

  • I want to get as close as possible to being able to 'flick a switch' to change RDBMS between SQL Server / SQL Azure and PostgreSQL / Cloud based PostgreSQL.

  • I want to take advantage of an ORM as much as possible (the ORM MUST IDEALLY require little more than changing a setting to switch to one of these alternative database backend).

  • This should include calling stored procedures in the same way with all.

For the interest of many, I am looking for OPTIONS with detailed limitations from hands on experience.

  • Please do NOT give answers like "not possible" or "don't bother".
  • Please do NOT compare ORMs in any other way than their ability to do the above and how much of their functionality is retained. This should NOT turn into x ORM is better than y ORM.
  • Please do NOT discuss limitations of SQL Azure vs dedicated hosting.
  • Please do NOT discuss SQL Server or PostgreSQL differences, strengths/weaknesses, stored procedure conversion, etc.
  • Please do NOT discuss what should be in stored procedures and what should be in service layers.
Darren
  • 9,014
  • 2
  • 39
  • 50
  • 2
    That's a lot of rules for answering your question. – jrummell May 15 '12 at 16:59
  • Yes... to keep the focus on the question. I know it's a bit full on. :-) – Darren May 17 '12 at 06:34
  • I came across two similar questions: [Mentions Nhibernate and Dataobjects ORM](http://stackoverflow.com/questions/1449086/asp-net-mvc-with-postgres-orm-recommendations). [Entity framework Specific](http://stackoverflow.com/questions/1211475/entity-framework-postgresql) – Darren May 19 '12 at 12:51

1 Answers1

3

It appears that Entity Framework supports your requirements. It can definitely connect to both of your providers. It looks like you can use stored procs, too, but that's a little fuzzy.

I believe the only "switch" you flip is in the .config file (no rebuild).

As an aside in case it's relevant, the new EF Code First + Migrations bits are pretty neat. I've been using them with SQL Server locally for development and a SQL Server cloud host for production. I've been very happy with them.

Michael Haren
  • 105,752
  • 40
  • 168
  • 205
  • Thanks, I was aware of devart, but not virtuoso and PgFoundry providers. I will upvote your answer, but I will not mark as accepted...hopefully someone else can provide more detailed information. Your statement starting "I believe" leaves me still unsure. When the time comes (if no other answer) I guess I may try a simple project with a few tables and try switching between these providers. I have not used Entity Framework yet so I don't know any better. – Darren May 17 '12 at 06:32
  • Marked as answered, I have investigated further. I like the look of the following Micro ORMs: Peta-Poco Dapper, ORM-Lite for performance reasons but I might to well to use EF5 intially for scaffolding/RAD reasons. – Darren Dec 11 '12 at 06:15