public static string ToQueryString <T>(this IQueryable <T> source)
 {
     if (source.Provider is MapinfoProvider)
     {
         MapinfoProvider provider = source.Provider as MapinfoProvider;
         return(provider.GetQueryString(source.Expression));
     }
     else
     {
         throw new ArgumentOutOfRangeException("Source provider is not a Mapinfo Query Provider");
     }
 }
 public static string ToQueryString <T>(this IQueryable <T> source)
 {
     if (source.Provider is MapinfoProvider)
     {
         MapinfoProvider provider = source.Provider as MapinfoProvider;
         return(provider.GetQueryString(source.Expression));
     }
     else
     {
         throw new ArgumentOutOfRangeException("source", source.Provider.GetType().Name,
                                               "Expected MapinfoProvider but was {0}".FormatWith(source.Provider.GetType().Name));
     }
 }