How can I pass in a params of Expression<Func<T, object>> to a method?
- by Pure.Krome
Hi folks,
I have the following two methods :-
public static IQueryable<T> IncludeAssociations<T>(this IQueryable<T> source,
params string[] associations)
{ ... }
public static IQueryable<T> IncludeAssociations<T>(this IQueryable<T> source,
params Expression<Func<T, object>>[] expressions)
{ ... }
Now, when I try and pass in a params of Expression<Func<T, object>>[], it always calls the first method (the string[]' and of course, that value isNULL`)
Eg.
Expression<Func<Order, object>> x1 = x => x.User;
Expression<Func<Order, object>> x2 = x => x.User.Passport;
var foo = _orderRepo
.Find()
.IncludeAssociations(new {x1, x2} )
.ToList();
Can anyone see what I've done wrong? Why is it thinking my params are a string? Can I force the type, of the 2x variables?