What I want to do is convert my whole application to nhibernate from ADO.NET and test it using different databases. i know nhibernate supports many different databases so can i switch between different databases without changing any of my application or nhibernate code?
views:
54answers:
2The short answer: yes. The long answer: It depends :-) I've done this numerous times, switching between SQLite (during early development and unit testing) and SQL Server (for later development, integration testing and production) with no code changes or recompilation - just Web.config changes.
If your application is fairly complex then you might run into some portability issues, but NHibernate is still a no-brainer if you want to support multiple RDBMS products for your application. Any such portability issues will usually be fairly straightforward to work around.
As long as you do not write any specific queries targetted for a specific DMBS (which is possible using NHiberate (ISession.CreateSqlQuery
), I would say that it is possible.
But, queries that have been written using hql or ICriteria API should work out of the box on other DBMS'es. (Provided that NHibernate supports those DBMS).
Although, it might be necessary to change some config settings (http://fgheysels.blogspot.com/2007/07/nhibernate-ms-access-problems-with.html for instance).