将表联接与Lambda表达式一起使用

编程入门 行业动态 更新时间:2024-10-25 03:21:56
本文介绍了将表联接与Lambda表达式一起使用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

大家好, 我正在做MVC编码,并使用LLBLGEN Pro 3.5版本.我正在使用存储库模式,并且需要一些指导: 我有这段代码返回了IEnumerable(of T) _repositoryExtMailCost.FindByCondition(Function(x)x.EndDate is nothing or x.EndDate> = DateTime.Now) 结果包含一个外键,我需要用它来过滤其他表上的结果,像这样 _repositoryExtMailItem.FindByCondition(Function(x)x.ID ----) 该findbycondition是一个自定义函数,并使用func(t,boolean).现在我想使用第一个语句中返回的结果(外键),然后在最后一个语句中应用它,但是我不确定该怎么做?你们可以帮忙吗? 是否有类似于Entity Framework或LINQ To SQL之类的东西,例如我可以使用表联接,然后说此外键是另一个表的主键,因此将主键在列表中的所有结果提供给我? 谢谢你们.

Hi Guys, I am doing MVC Coding and using LLBLGEN Pro 3.5 version with it. I am using repository pattern and kind of need some guidance: I have this code which returns me an IEnumerable(of T) _repositoryExtMailCost.FindByCondition(Function(x) x.EndDate Is Nothing Or x.EndDate >= DateTime.Now) The result contains a foreign key that i need to use to filter the results on the other table like this _repositoryExtMailItem.FindByCondition(Function(x) x.ID ----) this findbycondition is a custom function and takes a func(of t, boolean). now i want to use the result (foreign key) returned in the first statement and then apply that in the last statement but i am not sure how can i do that? Can you guys help? Is there something similar to Entity Framework or LINQ To SQL like i can use Table joins and then say this foreign key is primary key of the other table and so give me all the results where primary key is in the list? Thanks Guys.

推荐答案

您需要阅读一些有关如何使用LINQ的联接的知识,以使您可以使用此. 附加链接: Linq to SQL教程 [ ^ ] Linq实体 [ ^ ] You need some reading on how to use joins using LINQ for that you may go up with this. Additional links: Linq to SQL Tutorial[^] Linq to Entities[^]

更多推荐

将表联接与Lambda表达式一起使用

本文发布于:2023-10-17 13:14:54,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1501024.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:表达式   Lambda

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!