Visual Studio 2005中的LINQ to SQL

时间:2022-12-31 09:07:04

I normally run VS 2008 at home and LINQ is built in. At work we are still using VS 2005 and I have the opportunity to start a new project that I would like to use LINQ to SQL.

我通常在家里运行VS 2008而LINQ是内置的。在工作中我们仍在使用VS 2005,我有机会启动一个新项目,我想使用LINQ to SQL。

After doing some searching all I could come up with was the MAY 2006 CTP of LINQ would have to be installed for LINQ to work in VS 2005.

在做了一些搜索之后,我想出的是LINQ的2006年5月CTP必须安装在LINQ才能在VS 2005中运行。

Does someone know the proper add ins or updates I would need to install to use LINQ in VS 2005 (preferably without having to use the CTP mentioned above).

有人知道在VS 2005中使用LINQ需要安装的正确添加项或更新(最好不必使用上面提到的CTP)。

2 个解决方案

#1


2  

You can reference System.Data.Linq.dll and System.Core.dll, and set your build target for C# 3.0 or the latest VB compiler, but everything else would have to be mapped manually (no designer support in VS2005 in LINQ to SQL RTM).

您可以引用System.Data.Linq.dll和System.Core.dll,并为C#3.0或最新的VB编译器设置构建目标,但其他所有内容都必须手动映射(在LINQ to SQL中VS2005中没有设计器支持RTM)。

#2


2  

It's no longer legal to use the May CTP (the beta software).

使用May CTP(测试版软件)已不再合法。

It's not legal to deploy System.Core.dll (among others) without installing .Net 3.5

在不安装.Net 3.5的情况下部署System.Core.dll(以及其他)是不合法的

The best way to do LINQ in VS2005 is to use LINQBridge for LinqToObjects, and to use simple table adapters or some other data access method to punt your data into objects (for further in-memory querying).

在VS2005中执行LINQ的最佳方法是使用LINQBridge for LinqToObjects,并使用简单的表适配器或其他一些数据访问方法将数据转换为对象(用于进一步的内存中查询)。

Also note: LinqToObjects expects Func(T) - which are essentially delegate types. LinqToSQL requires Expression(Func(T)) - which are expression trees and much harder to construct without the lambda syntax.

另请注意:LinqToObjects期望Func(T) - 它们本质上是委托类型。 LinqToSQL需要表达式(Func(T)) - 它们是表达式树,并且在没有lambda语法的情况下更难构造。

#1


2  

You can reference System.Data.Linq.dll and System.Core.dll, and set your build target for C# 3.0 or the latest VB compiler, but everything else would have to be mapped manually (no designer support in VS2005 in LINQ to SQL RTM).

您可以引用System.Data.Linq.dll和System.Core.dll,并为C#3.0或最新的VB编译器设置构建目标,但其他所有内容都必须手动映射(在LINQ to SQL中VS2005中没有设计器支持RTM)。

#2


2  

It's no longer legal to use the May CTP (the beta software).

使用May CTP(测试版软件)已不再合法。

It's not legal to deploy System.Core.dll (among others) without installing .Net 3.5

在不安装.Net 3.5的情况下部署System.Core.dll(以及其他)是不合法的

The best way to do LINQ in VS2005 is to use LINQBridge for LinqToObjects, and to use simple table adapters or some other data access method to punt your data into objects (for further in-memory querying).

在VS2005中执行LINQ的最佳方法是使用LINQBridge for LinqToObjects,并使用简单的表适配器或其他一些数据访问方法将数据转换为对象(用于进一步的内存中查询)。

Also note: LinqToObjects expects Func(T) - which are essentially delegate types. LinqToSQL requires Expression(Func(T)) - which are expression trees and much harder to construct without the lambda syntax.

另请注意:LinqToObjects期望Func(T) - 它们本质上是委托类型。 LinqToSQL需要表达式(Func(T)) - 它们是表达式树,并且在没有lambda语法的情况下更难构造。