I want use a Linq IQueryable Toolkit in project on .NET Compact Framework. The Linq capabilities in CF is little bit shapred - i.e.: IQueryable interface is not available. So I've found third party libraries, which implements missing functionality what I need.
Now I have problem with missing method "MethodBase.GetCurrentMethod()". There is cca 100 methods, which uses this method. So I don't need the exact clone of "GetCurrentMethod()". The workaround way for this specific case is enough.
Sample of original code:
public static bool Any<TSource>( this IQueryable<TSource> source ) {
return source.Provider.Execute<bool>( Expression.Call( null, ((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod( new Type[] { typeof( TSource ) } ), new Expression[] { source.Expression } ) );
}
public static bool Any<TSource>( this IQueryable<TSource> source, Expression<Func<TSource, bool>> predicate ) {
return source.Provider.Execute<bool>( Expression.Call( null, ((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod( new Type[] { typeof( TSource ) } ), new Expression[] { source.Expression, Expression.Quote( predicate ) } ) );
}
The posibile solution is replace "(MethodInfo)MethodBase.GetCurrentMethod()" with specific method call. For example: GetMethod_Any_TSource_On_Source() and GetMethod_Any_TSource_On_Source_With_Predicate_TSource_Bool().
I search for some handy solution how to solve it.