开发者

Using LINQ to connect with multiple databases

I am developing an ASP.NET application in which I need to provide suppo开发者_运维问答rt for two databases, MySql and MS SQL Server 2005 and 2008 (one database will be used at a time).

  1. How will I configure the ASP.NET app to connect with different databases without reinstalling the app (i.e. using configuration)?

  2. How will I configure LINQ?

  3. Shouldn't I use NHibernate?


Use basic Linq to SQL structures (nothing database specific) and by just changing the connection string should do the trick. Linq expression trees are transformed to SQL by Linq enabled drivers (i.e. they know how to handle the expression tree).


Here is better way of doing it: Multiple database support with Entity Framework.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜