开发者

how to write database independent layer using Linq

开发者 https://www.devze.com 2023-02-11 17:04 出处:网络
How I can write database independent, data layer using Linq to Sql? For example I have one dbml file, which I can use with almost any database at runtime ( by specifying web.config)

How I can write database independent, data layer using Linq to Sql? For example I have one dbml file, which I can use with almost any database at runtime ( by specifying web.config)

Entity framwork is a better option, but it is not implemented in Mono so I can't use it.

Edit: I mean different databases like Sql Server, Mysql or SqlLite. I prefer to use DbLinq for other databases.

Edit 2 : I have cre开发者_如何学编程ated Linq to Sql mapping class by following this blog post. http://blogs.msdn.com/b/spike/archive/2010/01/08/how-to-use-linq-to-sql-without-using-the-designer-generated-classes.aspx Now how I can use this with other databases.


You need a 3rd party linq provider like ALinq http://www.alinq.org/ that suports Mono.
As it is structured from Microsoft, Linq to SQL is VERY database dependent, ie it only works with MS SQL. I believe that ALinq does work on mono. Here's a better list of 3rd party providers:
http://blog.linqexchange.com/index.php/links-to-linq-providers/

0

精彩评论

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