vendredi 4 août 2017

How to match method with a complex generic parameter using reflection?

I am trying to call a EntityFramework method using reflection. The signature of the method is

DbCollectionEntry<TEntity, TElement> Collection<TElement> 
(Expression <Func<TEntity, ICollection <TElement>>> navigationProperty) where TElement : class

where TEntity is a type parameter of the class. How can construct a type which which will equal Expression<Func<TEntity, ICollection <TElement>>> so I can find the right overload of the method? I tried typeof(Expression<Func<,>>) which displays the same in the debugger but doesn't match by equality.





Aucun commentaire:

Enregistrer un commentaire