I’m using a third party library which contains a bunch of extension methods on top of IQueryable. To use these extension methods i don’t wish to have my application littered with using statements to the third party namespace in which the extension method resides in.
This is so that i can switch it out the library sometime in the near future as easily as possible. However i’m not sure what’s the best way of doing this. One option i did contemplate was to create my own set of extension methods within the project (then i can control the namespace). The problem with this is i can’t see how i can maintain the name of the existing extension method. For example:
namespace MyProject.Extensions {
public static class IQueryableExtension {
public static IQueryable<T> Fetch<T, K>(this IQueryable<T> queryable, Expression<Func<T, K>> selector) {
return queryable.Fetch(selector);
}
}
}
You may see the problem here. Where i am trying to call the third party extension method within mine it actually calls itself creating an infinite loop.
I’d appreciate the help. Thanks
You don’t have to use extension methods as extension methods, you can use them like static methods… so you could call the 3rd party Fetch method: