entity framework 6 - What's the equivalent to not using params with Expression<Func<>>[]? -
i have code in repository base class entity framework eager loads navigation properties:
public virtual list<t> find(func<t, bool> where, params expression<func<t, object>>[] navigationproperties) { //blah biddy blah blah } then when calling above method:
var beers = beerrepository.find(x => x.type == "ipa", => a.ingredients, b => b.sizes, c => c.hangovers); it works great. know using "params" provides great magic shortcut when calling method , i've seen simple examples of needed without it.
but, i'm having trouble figuring out how call method above when remove params signature.
any thoughts?
a generic method method template. if supply type argument, becomes concrete, typed, method. method (without params)...
public virtual list<t> find<t>(func<t, bool> where, expression<func<t, object>>[] navigationproperties) ...in beerrepository turn like...
public virtual list<beer> find(func<beer, bool> where, expression<func<beer, object>>[] navigationproperties) ...which shows have provide expression<func<beer, object>>[] array. takes bit more clunky code build that, because can't take advantage of type inference:
var navprops = new expression<func<beer, object>>[] { => a.ingredients, => a.sizes, => a.hangovers });
Comments
Post a Comment