How to work with ASP.NET MVC and ODBC 2.0

I am starting a project that will include ASP.NET MVC using a legacy ODBC 2.0 compliant database. The goal is to replace the current functionality of the system with a web interface over a period of perhaps one year, after which replace the backend with SQL Server.

The plan is to code the SQL server and then insert some shims into the repository classes to use ODBC. Is it possible to do this? Entity Framework has no built-in ODBC support.

Any thoughts or advice would be appreciated.

0


a source to share


2 answers


I personally use NHibernate with MVC. I originally took it because our database doesn't support EF, but enjoy it, even if we switched to SQL Server, I would keep NHibernate.

The learning curve looks odd. It's definitely cool to become an expert, but it's interesting in that it's pretty organic to allow it to handle more and more work for you as you feel comfortable with some of the layers.



So, for your case, NHibernate probably supports your database, can be used as a simple data access layer (just returning a DTO), provides a database agnostic interface, and can support SQL Server when the time is right. If you end up wanting more of NHibernate, it will be there when the time is right.

+1


a source


Nothing prevents you from writing your own data access layer to query the ODBC database. You can also create your own entity layer so that the MVC model can populate your objects using the data layer and return those objects to the controller.

Basically, you have data access and entity level in your mvc application, then you can replace those entities, framework entity or nhibernate entities at a later date.



This way means that your MVC application doesn't need to know which database it is using, it also means that you need to have an easy time when you switch the object later.

+1


a source







All Articles