Click or drag to resize

SD.LLBLGen.Pro.LinqSupportClasses.ExpressionHandlers Namespace

 
Classes
  ClassDescription
Public classAliasCorrector
Specific expression handler which checks for all setaliases found in the expression to handle if they're reachable, and if not, it will try to retrieve the reachable alias. Does this for EntityFields only as those are the ones which require this operation in some situations. Handler is used in a specific case, where an expression's handled variant is used to replace an expression elsewhere in the tree, which means aliases change.
Public classAliasScoper
Specific expression handler which finds all Alias scopes (every 'RequiresProjection' border is seen as a new alias scope), and stores all aliases found inside such a scope in a newly pushed scope in the AliasSourceMappings.
Public classCloner
Specific expression handler clones EntityExpression and EntityFieldExpression instances, and with that the rest of the passed in expression. The cloning is based on the working of the genericexpressionhandler which makes copies of an expression if an element has changed. Cloner changes entityexpressions and entityfieldexpressions so a lambda referencing indireclty an EntityFieldExpression gets cloned entirely.
Public classCorrelationRelationFinder
Specific expression handler which looks up a correlationRelation in the tree to process and stops when one is found. It also removes the found correlationRelation from the entity expression it was found on, if the RemoveFoundRelationFromContainingExpression flag is set to true.
Public classDerivedTableFieldInjector
Specific expression handler which converts all elements passed in into entityfieldexpression objects with the name specified with the element and which targets a derived table with the alias specified. This is required for (among other things) groupby key references for example as these fields are always fields targeting a derived table.
Public classExpressionReplacer
Specific expression handler replaces parameters in expression with the expression specified in a list for that parameter.
Public classExpressionTreeKeyCreator
Simple key creator which tries to create a unique key for the expression tree handled.
Public classGenericExpressionHandler
Generic class for the expression handlers. This base class defines the overall mechanism engine and derived class(es) fill in the blanks how various elements have to be converted to LLBLGen Pro elements.
Public classJoinRewriter
Rewrites join trees by extracing where/orderby clauses and moving them up if possible. This is required before aliasscoper can do its job.
Public classLocalFunctionProducer
Specific expression handler which traverses a lambda expression and collects all EntityFieldExpression, EntityExpression, QueryExpressions and LLBLGenProExpressionExpression elements in the lambda and converts them into array index / parameter access expressions. This handler is used to convert a lambda found in a projection into a delegate to be used to produce values for projections in an llblgen pro projection
Public classMemberAccessEvaluator
Specific expression handler for converting expressions in the expression tree into entity field and entity type expressions, which are later on reduced by various handlers to LLBLGen Pro oriented elements. As it's the last step before the QueryExpressionBuilder step, it also does some fore-work for expressions which aren't really handled here, like the groupjoin's right-side expression extraction.
Public classNonProjectionExpressionExtractor
Specific expression handler which extracts non-projection expressions from the expression passed in, if there's no projection in the branch currently traversed. This is necessary in complex join scenario's where a where or orderby expression in one side of the join could contain another join and the where/orderby has to be moved upwards instead of being part of the side of a join and therefore has to be extracted from that expression tree. The extracted expressions are stored in a single list to all be handled and merged with the expression containing the expression passed in, and the expression the expressions are extracted from is stripped from these expressions. Not all where expressions are extracted: If a GroupJoin's Right side or DefaultIfEmpty is seen, keep the where clauses. Currently extracted expressions: WhereExpression, SortClauseExpression.
Public classPreProcessor
Specific expression handler which converts various method calls into their special Expression classes and it also collects and assigns source - alias combinations.
Public classQueryExpressionBuilder
Specific expression handler which evaluates JoinExpression nodes and converts them into a RelationCollectionExpression object or JoinResultExpression objects. It also handles SelectExpressions and reduces the tree. This has to be combined together in one evaluator because the joinExpression nodes can only be constructed if SelectExpressions (which can be one side of a join) can be reduced to full QueryExpressions. JoinResultExpressions are consumed by this same handler, if possible in the first take, into QueryExpressions. If the final query doesn't result in a QueryExpression, this class is used in a loop till it has resulted in a QueryExpression.
Public classQueryExpressionCoercer
Specific expression handler which converts any expression not already a QueryExpression into a QueryExpression. This class is used for special cases like: var q = metaData.Customer; so 'q' is not really an expression tree but a single Constant expression. but it also makes sure that for example LLBLGen Pro expressions in the form of a scalarqueryexpression object created by an additional scalar method call on a query, are converted into a query.
Public classRequiredProjectionCorrector
Specific expression handler which detects all instances which will be forced to become a query but aren't defined as such. The elements which fall into this category are moved where/orderby clauses which are locked in place and which are the element of a join side without a projection. This means that when they're handled, they'll be converted to a query, which then enforces a scope, however this scope is unknown to the rest of the system and the AliasScoper, so aliases wrapped into this scope are seen as part of the outer scope and the resulting query will fail. This class is used in the alias scoper after join trees have been rewritten by extracting where / order by clauses. This visitor flags when it's in a join side and from then on will set RequiresProjection to true for all where/orderby expressions. When it sees an expression with RequiresProjection set to true, it will stop correcting till it again is in a join side.