Iqueryable extension methods

The above method called on IQueryable<T> returned by NHibernate (T is Domain Model) takes the request parameters (ordering, pagination), applies them, and then transforms the results list from DomainModel to DTO Object of type TResponse. The list is then wrapped in a generic response class (generic, so it is reusable for many DTO types) c# genericsUsing extension methods to filter IQueryable data collections. 20 February 2012. As I talked about in my post Do we need the repository pattern?public static string ToQueryString (this System.Linq.IQueryable source); static member ToQueryString : System.Linq.IQueryable -> string <Extension()> Public Function ToQueryString (source As IQueryable) As String Parameters 15 thg 11, 2013 ... The Whe re method also takes a parameter named, predicate. 1899-IQueryable-Extensions-630x307.jpg. IQueryable does not store the results of a ...Since the edit for this answer seems legit, that's the direction I'll go first. Basically the following: Expression<Func<MyModel, bool>> func = (param) => param.Id == 1 var mockModel = new Mock<IQueryable<MyModel>> (); mockModel.Verify (x => x.Where (func));The extension method itself is quite small and does the conversion from IQueryable<Car> into IQueryable<CarReadModel>. public static IQueryable < CarReadModel > SelectCarReadModel (this IQueryable < Car > query) { return query.Select( c => new CarReadModel { Car = c, BrandName = c.Brand.Name }); } When to Call SelectCarReadModelHowever, when I use extension methods in a sub-query I get the following message: LINQ to Entities does not recognize the method 'System.Linq.IQueryable`1[eNotify.Domain.Models.User] IsActive(System.Linq.IQueryable`1[eNotify.Domain.Models.User])' method, and this method cannot be translated into a store expression.WebUse new EnumerableQuery<T> (this) instead of AsQueryable which doesn't perform this check. Workaround for .net 3.5: return ( (IEnumerable<T>)this).Select (x=>x).AsQueryable First casts to IEnumerable<T> so the chosen Select method will be Enumerable.Select not Queryable.Select. The identity select will then return a new object that does not.The usage of the "Queryable.DefaultIfEmpty" method. In the original and in the GroupJoin methods, correct methods that are chosen by the compiler are the "Enumerable.DefaultIfEmpty" methods. This has no influence in a simple query, but notice how the accepted answer has a bunch of Converts (between IQueryable and IEnumerable). printable 3d paper crafts templates freeWebExtend the type (using extension methods) with LINQ-like operators to provide custom querying. You by-pass provided querying methods from System.Linq and implement your own querying operators. The IEnumerable<T> is therefore intended to give types enumerable capability. Enumerable types are inherently queryable by using LINQ standard operators.int studentId = ( from u in db.Users .FromOrganisation (org.Id) .IsStudent () .IsActive () where u.ExtId == dto.StudentExtId select u.Id ).FirstOrDefault (); The extension methods are as follows: public static IQueryable<User> IsStudent (this IQueryable<User> u) { return u.Where (x => x.Type == (int)UserTypes.Student); } I recently created a blog around creating an IQueryable search extension method that enables the following syntax: string [] search = new string [] {"A", "B", "C"}; var searchQuery = context.Users.Search (u => u.Name, search); Update : START29 thg 4, 2021 ... Note that in this feature, and the Zip extension method above, there is both a IEnumerable and IQueryable version. All new APIs that return an ...The IQueryable extension methods build expression trees based on your command chain and then sends this request to the data provider when required. This means that your data provider is restricting the records that are brought into memory instead of having all records brought into, and filtered, in memory. MethodsThe IQueryable passed to the above extension method is generated by Entity Framework 4. Below the Query with the call to the extension method:28 thg 12, 2016 ... Here is the original query (where an error happens because a sub-query uses an IQueryable extension method): var vm = from o in db. johnny hd iptv review public static string ToQueryString (this System.Linq.IQueryable source); static member ToQueryString : System.Linq.IQueryable -> string <Extension()> Public Function ToQueryString (source As IQueryable) As String ParametersSince the edit for this answer seems legit, that's the direction I'll go first. Basically the following: Expression<Func<MyModel, bool>> func = (param) => param.Id == 1 var mockModel = new Mock<IQueryable<MyModel>> (); mockModel.Verify (x => x.Where (func));However, when I use extension methods in a sub-query I get the following message: LINQ to Entities does not recognize the method 'System.Linq.IQueryable`1[eNotify.Domain.Models.User] IsActive(System.Linq.IQueryable`1[eNotify.Domain.Models.User])' method, and this method cannot be translated into a store expression.int studentId = ( from u in db.Users .FromOrganisation (org.Id) .IsStudent () .IsActive () where u.ExtId == dto.StudentExtId select u.Id ).FirstOrDefault (); The extension methods are as follows: public static IQueryable<User> IsStudent (this IQueryable<User> u) { return u.Where (x => x.Type == (int)UserTypes.Student); } I am trying to use the Expression Visitor from LinqKit to take a call to an extension method I wrote, and replace it in the expression tree with the expression returned ...Mar 29, 2016 · IEnumerable VS IQueryable. In LINQ to query data from database and collections, we use IEnumerable and IQueryable for data manipulation. IEnumerable is inherited by IQueryable, Hence IQueryable has all the features of IEnumerable and except this, it has its own features. Both have its own importance to query data and data manipulation. temasek investments public static string ToQueryString (this System.Linq.IQueryable source); static member ToQueryString : System.Linq.IQueryable -> string <Extension()> Public Function ToQueryString (source As IQueryable) As String Parameters The IQueryable interface is intended for implementation by query providers. It is only supposed to ... feeding protein tubs to horsesThe majority of the methods in this class are defined as extension methods that extend the IQueryable<T> type. This means they can be called like an instance method on any object that implements IQueryable<T>. These methods that extend IQueryable<T> do not perform any querying directly.A toolset for creating Relay.js compatible GraphQL servers in dotnet. - Additional IQueryable extension methods to ResolveConnectionContextExtensions by myty · Pull ...WebJan 29, 2021 · You probably want your new extension method to have another argument, propSelector or something like that which would be of type Func<T,string> you could then use this func in your where to get the value you want to compare qList.Where(x => propSelector(x) == searchText);. you'd then call it context.Employees.MyAdvancedSearch("Mark", (x) => x.Name); Jun 06, 2012 · I am trying to use the Expression Visitor from LinqKit to take a call to an extension method I wrote, and replace it in the expression tree with the expression returned ... The IQueryable passed to the above extension method is generated by Entity Framework 4. Below the Query with the call to the extension method:Jan 29, 2021 · You probably want your new extension method to have another argument, propSelector or something like that which would be of type Func<T,string> you could then use this func in your where to get the value you want to compare qList.Where(x => propSelector(x) == searchText);. you'd then call it context.Employees.MyAdvancedSearch("Mark", (x) => x.Name); Value Method Applied to Description; None: Path through methods: IQueryable: This type of extension should not generate SQL and can be used to implement path through methods such as AsSqlServer() that converts IQueryable sequence to ISqlServerSpecificQueryable.The core of LINQ to Objects is IEnumerable<T>: Query methods are designed for IEnumerable<T> as extension methods, like Where (), Select (), etc.; Query methods are designed to be fluent, LINQ to Objects queries can be written in declarative paradigm via method chaining; Query methods are designed to be deferred execution as long as possible.7 thg 9, 2022 ... In LINQ to query data from database and collections, ... Extension methods support by IQueryable takes expression objects means expression ...The scientific method is important because it is an evidence-based method for acquiring knowledge. Unlike intuitive, philosophical or religious methods for acquiring knowledge, the scientific method relies on empirical, repeatable tests to ...The AsExpandable extension method can help with this. Search the web to find it as a small library. Using the same approach you should be able to inline constants such as the role ID into the query as well. Note, that the design of WhereInRole is not really ideal. Normally, you'd write a method bool IsUserInRole (User, int).Extend the type (using extension methods) with LINQ-like operators to provide custom querying. You by-pass provided querying methods from System.Linq and implement your own querying operators. The IEnumerable<T> is therefore intended to give types enumerable capability. Enumerable types are inherently queryable by using LINQ standard operators.Web[Solved]-Moq with IQueryable Extension Methods-LINQ,C# ... I suggest you to separate the Include method into a different static class such as: dr chavez cardiologist The majority of the methods in this class are defined as extension methods that extend the IQueryable<T> type. This means they can be called like an instance method on any object that implements IQueryable<T>. These methods that extend IQueryable<T> do not perform any querying directly.public static string ToQueryString (this System.Linq.IQueryable source); static member ToQueryString : System.Linq.IQueryable -> string <Extension()> Public Function ToQueryString (source As IQueryable) As String Parameters Useful extension methods for use with Entity Framework LINQ queries. ... If the underlying query object does not have an AsNoTracking method, then calling ...Jun 06, 2012 · I am trying to use the Expression Visitor from LinqKit to take a call to an extension method I wrote, and replace it in the expression tree with the expression returned ... The five basic steps of the scientific method are: make observations, propose a hypothesis, design and perform an experiment to test the hypothesis, analyze the data to see if it supports the hypothesis and, if necessary, propose and test a...Since the edit for this answer seems legit, that's the direction I'll go first. Basically the following: Expression<Func<MyModel, bool>> func = (param) => param.Id == 1 var mockModel = new Mock<IQueryable<MyModel>> (); mockModel.Verify (x => x.Where (func));LINQ can support aggregate queries, and AutoMapper supports LINQ extension methods. In the custom projection example, if we renamed the TotalContacts property to ContactsCount, AutoMapper would match to the Count () extension method and the LINQ provider would translate the count into a correlated subquery to aggregate child records.28 thg 12, 2016 ... Here is the original query (where an error happens because a sub-query uses an IQueryable extension method): var vm = from o in db.Jul 09, 2019 · I recently created a blog around creating an IQueryable search extension method that enables the following syntax: string[] search = new string[]{"A", "B", "C"}; var searchQuery = context.Users.Search(u => u.Name, search); Update : START. I have since updated search extensions which has affected the way a search is performed to use a new fluent ... int studentId = ( from u in db.Users .FromOrganisation (org.Id) .IsStudent () .IsActive () where u.ExtId == dto.StudentExtId select u.Id ).FirstOrDefault (); The extension methods are as follows: public static IQueryable<User> IsStudent (this IQueryable<User> u) { return u.Where (x => x.Type == (int)UserTypes.Student); } heavy duty surgical tubing Use new EnumerableQuery<T> (this) instead of AsQueryable which doesn't perform this check. Workaround for .net 3.5: return ( (IEnumerable<T>)this).Select (x=>x).AsQueryable First casts to IEnumerable<T> so the chosen Select method will be Enumerable.Select not Queryable.Select. The identity select will then return a new object that does not. The AsExpandable extension method can help with this. Search the web to find it as a small library. Using the same approach you should be able to inline constants such as the role ID into the query as well. Note, that the design of WhereInRole is not really ideal. Normally, you'd write a method bool IsUserInRole (User, int).public static class QueryExtensionMethods { public static IQueryable<RecordedWeight> ForCurrentUser(this IQueryable<RecordedWeight> weights, HttpContext httpContext) { var userId = httpContext.User.GetUserId(); return weights.Where(w => w.UserId == userId); } }public static string ToQueryString (this System.Linq.IQueryable source); static member ToQueryString : System.Linq.IQueryable -> string <Extension()> Public Function ToQueryString (source As IQueryable) As String ParametersWeb passwall windows 25 thg 6, 2015 ... IQueryable<T>... variant, this becomes a much easier problem since you no longer need ...CreateQuery... and you can execute directly against the ...By creating an extension method that both extends and returns IQueryable<T> we can create our own chainable filter method. 1 2 3 4 5 public static IQueryable<T> MyFilter(this IQueryable<T> query) { //do something return query; } An example filter extension method Let's look at an expanded version of our example of rather unintelligible LINQ code.28 thg 12, 2016 ... Here is the original query (where an error happens because a sub-query uses an IQueryable extension method): var vm = from o in db.public static string ToQueryString (this System.Linq.IQueryable source); static member ToQueryString : System.Linq.IQueryable -> string <Extension()> Public Function ToQueryString (source As IQueryable) As String Parameters May 13, 2013 · This extension method evaluates and executes the query immediately due to requesting a single value using the First () method: query.First (u => u.UserId == userId); The second code snippet gives us a PagedList model which becomes a valuable class when working with grids or pagination. The constructor accepts an IQueryable or IList and converts ... Linq; namespace OutOfMemory.Codes { /// <summary> /// Adds extension methods to the <see cref="IQueryable{T}"/> class. /// </summary> public static class ...Jun 06, 2012 · I am trying to use the Expression Visitor from LinqKit to take a call to an extension method I wrote, and replace it in the expression tree with the expression returned ... Remarks. Extension methods are syntactic sugar that allow static methods to be invoked on object instances as if they were a member of the type itself. Extension methods require an explicit target object. You will need to use the this keyword to access the method from within the extended type itself. Extensions methods must be declared static ...WebWeb intel i225 lan driver not working LINQ can support aggregate queries, and AutoMapper supports LINQ extension methods. In the custom projection example, if we renamed the TotalContacts property to ContactsCount, AutoMapper would match to the Count () extension method and the LINQ provider would translate the count into a correlated subquery to aggregate child records.As you can see in the above image, the IQueryable is an interface and it is available in System.Linq namespace. The IQuerable interface is a child of the IEnumerable interface. So we can store IQuerable in a variable of type IEnumerable. The IQuerable interface has a property called Provider which is of type IQueryProvider interface.Created an expression using extension method on the Queryable type, which internally calls OrderBy method of the Queryable type, expecting IQueryable to be the Input, along with the field name and thus runs the ordering function and Ordered collection is the final Outputpublic static string ToQueryString (this System.Linq.IQueryable source); static member ToQueryString : System.Linq.IQueryable -> string <Extension()> Public Function ToQueryString (source As IQueryable) As String Parameters A toolset for creating Relay.js compatible GraphQL servers in dotnet. - Additional IQueryable extension methods to ResolveConnectionContextExtensions by myty · Pull ... bash case syntax 29 thg 3, 2017 ... By moving this question from StackOverflow to here, usr's sensible remarks were lost. I restore them here as community wiki:.The scientific method is important because it is an evidence-based method for acquiring knowledge. Unlike intuitive, philosophical or religious methods for acquiring knowledge, the scientific method relies on empirical, repeatable tests to ...Here is the scenario: 1) Create an IQueryable extension method called DoSomething with an appropriate signature (IQueryable, int x, int y). 2) Create an IEnumerable extension method called DoSomething using the same signature as the IQueryable, EXCEPT accepting/returning an IEnumerable instead of IQueryable. data entry remote jobs near me public static string ToQueryString (this System.Linq.IQueryable source); static member ToQueryString : System.Linq.IQueryable -> string <Extension()> Public Function ToQueryString (source As IQueryable) As String Parameters Use new EnumerableQuery<T> (this) instead of AsQueryable which doesn't perform this check. Workaround for .net 3.5: return ( (IEnumerable<T>)this).Select (x=>x).AsQueryable First casts to IEnumerable<T> so the chosen Select method will be Enumerable.Select not Queryable.Select. The identity select will then return a new object that does not.IRepository interface inherits IQueryable , so you can directly use the standard LINQ extension methods, like Where , OrderBy , First , Sum ... etc.public static string ToQueryString (this System.Linq.IQueryable source); static member ToQueryString : System.Linq.IQueryable -> string <Extension()> Public Function ToQueryString (source As IQueryable) As String Parameters 16 thg 3, 2018 ... IQueryable<entity>' does not contain a definition for 'Join' and no extension method 'Join' accepting a first argument of type 'System.Linq.Use new EnumerableQuery<T> (this) instead of AsQueryable which doesn't perform this check. Workaround for .net 3.5: return ( (IEnumerable<T>)this).Select (x=>x).AsQueryable First casts to IEnumerable<T> so the chosen Select method will be Enumerable.Select not Queryable.Select. The identity select will then return a new object that does not. The LINQ's standard query operators such as select, where, etc. are implemented in the Enumerable class. These methods are implemented as extension methods of ...25 thg 6, 2015 ... IQueryable<T>... variant, this becomes a much easier problem since you no longer need ...CreateQuery... and you can execute directly against the ...Extension method to declare the fields/metadata properties to load while executing the REST query Declaration public static IQueryable<TResult> QueryProperties<TResult>(this IQueryable<TResult> source, params Expression<Func<TResult, object>>[] selectors)If you’ve ever had a great idea for something new, then you know some testing is necessary to work out the kinks and make sure you get the desired result. The steps that make up the scientific method generally fall into three phases: observ...LINQ can support aggregate queries, and AutoMapper supports LINQ extension methods. In the custom projection example, if we renamed the TotalContacts property to ContactsCount, AutoMapper would match to the Count () extension method and the LINQ provider would translate the count into a correlated subquery to aggregate child records.My goal was to Invoke the below extension method, thus returning the IQueryable for the query in the extension method. Essentially replacing the AsOf call with the query it represents, so that Linq2Entities will not choke on the "asOf" method that it would not recognize.29 thg 4, 2021 ... Note that in this feature, and the Zip extension method above, there is both a IEnumerable and IQueryable version. All new APIs that return an ...IQueryable whose elements are filtered according to conditions set in the business rule. Syntax. public static IQueryable Filter( this IQueryable source, Type ...12 thg 6, 2022 ... The extension methods in System.Linq.Queryable operate on instances of IQueryable, by building an expression tree (Expression).,IQueryable ...A toolset for creating Relay.js compatible GraphQL servers in dotnet. - Additional IQueryable extension methods to ResolveConnectionContextExtensions by myty · Pull ...Use new EnumerableQuery<T> (this) instead of AsQueryable which doesn't perform this check. Workaround for .net 3.5: return ( (IEnumerable<T>)this).Select (x=>x).AsQueryable First casts to IEnumerable<T> so the chosen Select method will be Enumerable.Select not Queryable.Select. The identity select will then return a new object that does not. 5 thg 8, 2018 ... LINQ Extension Methods - Part One ... Linq provides standard query operators like filtering, sorting, grouping, aggregation, and concatenations, ...The IQueryable interface is intended for implementation by query providers. It is only supposed to ... I code these: public static IQueryable<T> And<T>(this IQueryable<T> source, Expression<Func<T, bool>> predicate) MethodCallExpression methodCallExpr = ((MethodCallExpression)source.Expression); if (methodCallExpr.Arguments.Count != 2) return source;int studentId = ( from u in db.Users .FromOrganisation (org.Id) .IsStudent () .IsActive () where u.ExtId == dto.StudentExtId select u.Id ).FirstOrDefault (); The extension methods are as follows: public static IQueryable<User> IsStudent (this IQueryable<User> u) { return u.Where (x => x.Type == (int)UserTypes.Student); }Jan 30, 2008 · For the left outer join, I think we need to use DefaultIfEmpty method as you said. But if the extension methods do not export the return value as IQueryable<> or IQueryable, it would be really hard to realize them dynamically. My next idea is the same as yours, to use SQL commands directly. barn door curtains Entity framework IQueryable extension methods do not work with a sub query · Issue #98 · dotnet/ef6 · GitHub I like to write my queries using extension methods where possible. So the following is a query which works for me. It gets all users that are Students. var studentList = ( from u in db.Users .IsStudent() select u ).ToList(); Here is the ...13 thg 6, 2013 ... Dynamic LINQ Extension Method · 1: public static IQueryable<T> Where<T>(this IQueryable<T> query, String restriction, params Object[] values) · 2: ... nightmare before christmas decorations halloween The IQueryable interface is intended for implementation by query providers. It is only supposed to ... Use new EnumerableQuery<T> (this) instead of AsQueryable which doesn't perform this check. Workaround for .net 3.5: return ( (IEnumerable<T>)this).Select (x=>x).AsQueryable First casts to IEnumerable<T> so the chosen Select method will be Enumerable.Select not Queryable.Select. The identity select will then return a new object that does not. Remarks. Extension methods are syntactic sugar that allow static methods to be invoked on object instances as if they were a member of the type itself. Extension methods require an explicit target object. You will need to use the this keyword to access the method from within the extended type itself. Extensions methods must be declared static ...The scientific method is important because it is an evidence-based method for acquiring knowledge. Unlike intuitive, philosophical or religious methods for acquiring knowledge, the scientific method relies on empirical, repeatable tests to ...Webpublic static iqueryable filternumber ( this iqueryable qlist, expression> property, string filterquery) { if (string.isnullorempty (filterquery)) return qlist; var match = regex.match (filterquery.trim (), "^ (?|>=|= {1,2}|!=|<>)?\\s? (?\\d+)$"); if (!match.success) throw new exception (); var number = int.parse (match.groups …Jun 06, 2012 · I am trying to use the Expression Visitor from LinqKit to take a call to an extension method I wrote, and replace it in the expression tree with the expression returned ... Returns IQueryable<TEntity> . An IQueryable<T> representing the interpolated string SQL query.. Remarks. If the database provider supports composing on the supplied SQL, you can compose on top of the raw SQL query using LINQ operators.A toolset for creating Relay.js compatible GraphQL servers in dotnet. - Additional IQueryable extension methods to ResolveConnectionContextExtensions by myty · Pull ...Async. Starts execution of IQueryable on a ThreadPool thread and returns immediately with a "end" method to call once the result is needed. C# System ...You probably want your new extension method to have another argument, propSelector or something like that which would be of type Func<T,string> you could then use this func in your where to get the value you want to compare qList.Where(x => propSelector(x) == searchText);. you'd then call it context.Employees.MyAdvancedSearch("Mark", (x) => x.Name); ps5 stuttering reddit As you can see in the above image, the IQueryable is an interface and it is available in System.Linq namespace. The IQuerable interface is a child of the IEnumerable interface. So we can store IQuerable in a variable of type IEnumerable. The IQuerable interface has a property called Provider which is of type IQueryProvider interface.The IQueryable passed to the above extension method is generated by Entity Framework 4. Below the Query with the call to the extension method:IQueryable whose elements are filtered according to conditions set in the business rule. Syntax. public static IQueryable Filter( this IQueryable source, Type ...My goal was to Invoke the below extension method, thus returning the IQueryable for the query in the extension method. Essentially replacing the AsOf call with the query it represents, so that Linq2Entities will not choke on the "asOf" method that it would not recognize. baker mod Methods C# Queryable. Where Method Reference Feedback Definition Namespace: System. Linq Assembly: System.Linq.Queryable.dll Filters a sequence of values based on a predicate. In this article Definition Overloads Where<TSource> (IQueryable<TSource>, Expression<Func<TSource,Boolean>>) Jan 30, 2008 · For the left outer join, I think we need to use DefaultIfEmpty method as you said. But if the extension methods do not export the return value as IQueryable<> or IQueryable, it would be really hard to realize them dynamically. My next idea is the same as yours, to use SQL commands directly. An OrderBy extension method for IQueryable that takes string Raw gistfile1.cs This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters ...Here is the scenario: 1) Create an IQueryable extension method called DoSomething with an appropriate signature (IQueryable, int x, int y). 2) Create an IEnumerable extension method called DoSomething using the same signature as the IQueryable, EXCEPT accepting/returning an IEnumerable instead of IQueryable. fizika 10 mediaprint ushtrime te zgjidhura pdf WebWebWebIQueryable queries are obtained with the Query methods used on the ISession or IStatelessSession. (Prior to NHibernate 5.0, these methods were extensions ...Web funniest jokes in the world knock knock Methods C# Queryable. Where Method Reference Feedback Definition Namespace: System. Linq Assembly: System.Linq.Queryable.dll Filters a sequence of values based on a predicate. In this article Definition Overloads Where<TSource> (IQueryable<TSource>, Expression<Func<TSource,Boolean>>) Jun 06, 2012 · I am trying to use the Expression Visitor from LinqKit to take a call to an extension method I wrote, and replace it in the expression tree with the expression returned ... public static class QueryExtensionMethods { public static IQueryable<RecordedWeight> ForCurrentUser(this IQueryable<RecordedWeight> weights, HttpContext httpContext) { var userId = httpContext.User.GetUserId(); return weights.Where(w => w.UserId == userId); } }26 thg 9, 2017 ... It possibly isnt as I'm still learning Linq. ... a definition for 'DefaultIfEmpty' and the best extension method overload 'Queryable.public static string ToQueryString (this System.Linq.IQueryable source); static member ToQueryString : System.Linq.IQueryable -> string <Extension()> Public Function ToQueryString (source As IQueryable) As String ParametersI code these: public static IQueryable<T> And<T>(this IQueryable<T> source, Expression<Func<T, bool>> predicate) MethodCallExpression methodCallExpr = ((MethodCallExpression)source.Expression); if (methodCallExpr.Arguments.Count != 2) return source; cartoon trivia multiple choice Use new EnumerableQuery<T> (this) instead of AsQueryable which doesn't perform this check. Workaround for .net 3.5: return ( (IEnumerable<T>)this).Select (x=>x).AsQueryable First casts to IEnumerable<T> so the chosen Select method will be Enumerable.Select not Queryable.Select. The identity select will then return a new object that does not.Queryable Extensions. When using an ORM such as NHibernate or Entity Framework with AutoMapper’s standard mapper.Map functions, you may notice that the ORM will query all the fields of all the objects within a graph when AutoMapper is attempting to map the results to a destination type. If your ORM exposes IQueryable s, you can use AutoMapper ... Use new EnumerableQuery<T> (this) instead of AsQueryable which doesn't perform this check. Workaround for .net 3.5: return ( (IEnumerable<T>)this).Select (x=>x).AsQueryable First casts to IEnumerable<T> so the chosen Select method will be Enumerable.Select not Queryable.Select. The identity select will then return a new object that does not.Extend the type (using extension methods) with LINQ-like operators to provide custom querying. You by-pass provided querying methods from System.Linq and implement your own querying operators. The IEnumerable<T> is therefore intended to give types enumerable capability. Enumerable types are inherently queryable by using LINQ standard operators. caddo parish commission