我正在Visual Studio 2010中使用SQL UDF项目类型在C#中创建SQL Server用户定义函数.我的代码中有一个简单的Linq字符串操作表达式(myString.Where()),由于我生成了一个错误,没有使用 System.Linq 名称空间.如果我添加
I am creating a SQL Server user-defined function in C# using the SQL UDF project type in Visual Studio 2010. I have a simple Linq string manipulation expression (myString.Where()) in my code that generates an error because I'm not using the System.Linq namespace. If I add
using System.Linq;在我的.cs文件中,出现一个错误,问我是否缺少程序集引用.如果然后我在解决方案资源管理器中右键单击该项目,然后选择添加引用",则.NET选项卡中没有列出 System.Linq 组件.
to my .cs file, I get an error asking me if I'm missing an assembly reference. If I then right-click the project in Solution Explorer, and select "Add Reference", there is no System.Linq component listed in the .NET tab.
我想我可以浏览硬盘驱动器中的适当程序集DLL,但是Visual Studio为什么不知道它呢?在SQL CLR代码中使用Linq有一些限制吗?
I suppose I could go browsing the hard drive for the appropriate assembly DLL, but why doesn't Visual Studio know about it? Is there some restriction about using Linq in SQL CLR code?
推荐答案好吧,显然,在项目中添加对System.Core.DLL的引用将允许"using System.Linq"语句在SQL CLR项目中进行编译.走吧.
Okay, apparently adding a reference to System.Core.DLL to the project will allow the "using System.Linq" statement to compile in a SQL CLR project. Go figure.
更多推荐
在SQL CLR UDF中使用System.Linq程序集
发布评论