Lambda Expression Dilemma With LLBLGen

Posts   
 
    
vivek
User
Posts: 45
Joined: 06-Sep-2012
# Posted on: 11-Oct-2012 10:17:59   

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?

I know of other way to do this. Using a SQL View and do the join there and then just pass the values to the view and display the results but i would prefer going the above way if possible at all? Can anyone please help?

Thanks Guys.

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 11-Oct-2012 22:24:00   

The method returns a list (IEnumerable). Are you trying to call the other method for each entity of the IEnumerable? If so, then you'll need to loop on the returned list.

vivek
User
Posts: 45
Joined: 06-Sep-2012
# Posted on: 12-Oct-2012 05:12:02   

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?

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 12-Oct-2012 11:01:45   

Not sure I understand you. Could you please give an example?