Linq和编译的查询
这是我的代码:
我需要将属性a.Value的值关联到Literal.Text属性。
你知道怎么做吗?感谢您的宝贵帮助!
using (var context = new CmsConnectionStringEntityDataModel())
{
context.CmsOptions.MergeOption = MergeOption.NoTracking;
var query = CompiledQuery.Compile<CmsConnectionStringEntityDataModel, IQueryable<CmsOption>>
(ctx => from a in ctx.CmsOptions where a.OptionId == 7 select a);
uxHeaderIncluder.Text = // What I do here?;
}发布于 2011-07-20 17:06:03
你看过这些例子吗:http://www.blog.ingenuitynow.net/15+Minutes+On+LINQ+Compiled+Queries.aspx http://msdn.microsoft.com/en-us/library/bb896297.aspx
该方法的核心是在编译方法调用中指定输入类型。您的编译调用应该是这样的:
CompiledQuery.Compile<CmsConnectionStringEntityDataModel,string,string, IQueryable<CmsOption>>
((ctx,str1,str2)=>from a in ctx.CmsOptions where a.OptionId == 7 && /* use str1 and str2 params here */ select a);https://stackoverflow.com/questions/6757938
复制相似问题