有没有一种方法使用与.NET 3.0的项目LINQ查询语法?语法、方法、项目、NET

2023-09-07 02:55:31 作者:可以哭但绝不认输〃

我也只能部署在运行.NET 3.0的服务器上的一个项目。 我拼命地想使用LINQ来简化一些极度沉闷的逻辑。 有没有做到这一点的简单方法?我会满足于任何语法。

I have a project which can only be deployed on a server running .NET 3.0. I desperately want to use LINQ to simplify some excruciatingly tedious logic. Is there a simple way to accomplish this? I'll settle for any syntax.

多谢

推荐答案

由于.NET 2.0到3.5的所有运行在CLR 2.0中,所有的LINQ的东西只是一堆库。如果包括缺少您的框架版本的DLL文件,它会工作得很好。

Since .NET 2.0 through 3.5 all run on the CLR 2.0, all the LINQ stuff is just a bunch of libraries. If you include the DLLs that are missing on your version of the framework, it will work just fine.

帕特里克说,关键的3.5的DLL文件是System.Core.dll的(提供了System.Linq的)和System.Data.Linq.dll(对LINQ到SQL)。

As Patrick says, the key 3.5 DLLs are System.Core.dll (which provided System.Linq) and System.Data.Linq.dll (for Linq-to-SQL).

如果你做到这一点,我想你至少从.NET 2.0SP1我认为需要System.dll中。

If you do this, I think you need System.dll from at least .NET 2.0SP1 I believe.

LINQBridge,如引述马克,作品被重新实现的功能,但只对LINQ到对象,我相信。

LINQBridge, as cited by Marc, works by re-implementing the functionality but only for Linq-to-Objects I believe.

另一种方法是从Mono项目使用这些相同的DLL(System.Core.dll的和System.Data.Linq.dll)。他们重新实现所有LINQ的。 LINQ的到SQL的东西也许有点不成熟,但它确实有美德与不仅仅是MSSQL数据库等工作。

Another option is to use these same DLLs (System.Core.dll and System.Data.Linq.dll) from the Mono project. They have reimplemented all of LINQ. The Linq-to-Sql stuff is perhaps a little immature but it does have the virtue of working with other databases than just MSSQL.

http://mono-project.com/Main_Page

这将删除分发微软的DLL与应用程序的合法性的任何问题。

This removes any question of the legality of distributing Microsoft DLLs with your application.