Reputation: 3238
Let's say I need create custom expression to make some manipulation with IQueryable<x>
and IQueryable<y>
. Regretfully I do not have idea how to implement this. This is my try:
public static IQueryable<T> JoinQueries<T>(this IQueryable<T> query, IQueryable<T> expr)
{
if (query == null)
throw new ArgumentNullException("query");
//Here we make Join for x and and return result something like this:
query = from a in query join b in expr on a.Id equals b.Id select a;
return query;
}
Or say other words I need result like this:
IQueryable <somevalue> x = query.CustomJoinExtension(Iqueryablevalue);
Upvotes: 0
Views: 230
Reputation: 6050
Something like this:
public static IQueryable<T> JoinQueries<T>
(this IQueryable<T> query, IQueryable<T> expr) where T : IHasId
{
if (query == null)
throw new ArgumentNullException("query");
//Here we make Join for x and and return result something like this:
query = from a in query join b in expr on a.Id equals b.Id select a;
return query;
}
public interface IHasId
{
int Id { get; set; }
}
Upvotes: 1