NJection.LambdaConverter | C # Delegate to LambdaExpression Converter Library | DevOps library
kandi X-RAY | NJection.LambdaConverter Summary
kandi X-RAY | NJection.LambdaConverter Summary
NJection.LambdaConverter is an open-source .NET assembly for converting delegates resolved from methods/constructors to expression trees.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of NJection.LambdaConverter
NJection.LambdaConverter Key Features
NJection.LambdaConverter Examples and Code Snippets
Community Discussions
Trending Discussions on NJection.LambdaConverter
QUESTION
I have extension methods that I am using in the query. Here are the methods:
...ANSWER
Answered 2020-May-14 at 07:47You have to be aware of the difference between an IEnumerable and an IQueryable.
An object that implements IEnumerable represents a sequence: you can get the first element of the sequence, and once you got an element, you can ask for the next element in the sequence.
At its lowest level this is done using GetEnumerator(), and repeatedly MoveNext() / Current. foreach, ToList(), Any(), Count(), etc will deep inside use these methods.
An IQueryable however, does not represent the sequence itself, it represents the potential to create a sequence
To do this, the IQueryable holds an Expression and a Provider. The Expression is a general description of what data must be set. The Provider knows who must provide the data (usually a database management system), and what language is used to communicate with the DBMS (usually SQL).
As long as you concatenate LINQ statements that return IQueryable<...>
, you are only changing the Expression. Only if you start enumerating, either by using GetEnumerator / MoveNext, or higher level: foreach, ToList, etc, the Expression is sent to the Provider, who will translate it into SQL and execute the query. The returned data is represented as an enumerable sequence.
The problem is that the Provider does not know your methods GetSourceUOM
. GetParentUOM
, etc. Therefore it can't translate them into SQL. In fact, there several LINQ methods that also can't be used. See Supported and Unsupported LINQ methods.
What you can do, is convert your extension methods such that it extends IQueryable
.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install NJection.LambdaConverter
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page