简体   繁体   English

LinqDataSource语法

[英]LinqDataSource Syntax

I have quite a complex LinqDataSource that I'm trying to setup. 我正在尝试设置一个非常复杂的LinqDataSource。 I've been able to write part of the Linq for it but am unsure how to convert this to LINQDataSource syntax or whether it is even possible. 我已经能够为其编写Linq的一部分,但不确定如何将其转换为LINQDataSource语法,甚至不确定是否可行。 It looks like this. 看起来像这样。

ConfigDetails.Where (cd => 
AuthProductOwners
   .Where (o => (o.LoginID == @LoginID ))
   .Select (o => o.AuthProductOwnerGroups).Contains(cd.AuthProductOwnerGroups))

The table structure is a AuthProductOwnerGroup can have many ConfigDetails and also many AuthProductOwners. 表结构是AuthProductOwnerGroup,可以具有许多ConfigDetails和许多AuthProductOwners。

Thanks 谢谢

I am not sure I understand your question completely, but I guess you find it difficult to transfer your Linq statement to the datasource. 我不确定我是否完全理解您的问题,但我想您会发现很难将Linq语句传输到数据源。 Is that corrrect? 那是正确的吗?

If so: The easiest solution is to create a simple Linq datasource and implement the linqdatasource selecting event and put your query there. 如果是这样:最简单的解决方案是创建一个简单的Linq数据源并实现linqdatasource选择事件并将查询放在此处。

More info: http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.linqdatasource.selecting.aspx 更多信息: http : //msdn.microsoft.com/zh-cn/library/system.web.ui.webcontrols.linqdatasource.selecting.aspx

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM