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.
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
.configfile (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.