LinqUtils Methods |
The LinqUtils type exposes the following members.
Name | Description | |
---|---|---|
AddFieldToProjectionIfNotPresent |
Adds the field to projection if not present already. If the projection is an entity projection, only the field aliases are compared. If the projection is a valuelist projection,
field alias and field objectalias are compared.
| |
AddFromClauseDirectivesToRelationsCollection |
Adds the specified from clause directives to the relation collection specified. If the relation collection is null and there are from clause directives to add, a new
relation collection is created.
| |
AddPathEdgesToPrefetchPath |
Adds the path edge to the prefetch path passed in.
| |
AddPathEdgesToPrefetchPathElement |
Adds the path edges to prefetch path element.
| |
AddRelationsRangeToRelationsCollection |
Adds the relations range in source to the relations collection called destination. If destination is null and source is not empty,
a new relationcollection is returned with source's relations added to it.
| |
CalculateRowHashForSpecifiedValues |
Calculates the row hash from the values at the specified indices
| |
CheckIfImplicitCast |
Checks if the cast from fromType to toType is an implicit cast.
| |
CheckifJoinIsFullQuery |
Checks if the passed in join is a full query or just a join.
It's a full query if the projection lambda has as output type not a type which is build from the two input types.
| |
CloneField(IEntityFieldCore) |
Clones the field passed in.
| |
CloneField(IEntityFieldCore, Boolean) |
Clones the field passed in.
| |
CoerceBooleanExpressionToDbFunctionCallParameter |
Coerces the boolean expression to a db function call parameter.
| |
CoercePredicateToPredicateExpression |
Coerces the predicate to predicate expression.
| |
CoerceSetReferenceExpressionToEntityFieldExpressionIfRequired |
Coerces the set reference expression to entity field expression if required.
| |
CoerceToSet |
Coerces the passed in linq expression to setexpression. If the passed in expression is a parameter, it will convert it to a setreference expression
otherwise it will try to cast it to a setexpression. If this can't be done, in the situation where tocoerce isn't a setexpression, null is returned.
| |
CoerceToType |
Coerces the linq expression to the targettype.
| |
ConvertLocalExpressionToRealObject |
Converts the local expression to a real object. This is done by a trick: we'll compile the whole expression as a lambda and run it.
this will return the object, including initialization results and completely materialized as we want it. The passed in expression is for example a
list or array initialization / ctor call. To utilize the in-memory object, we've to run this ctor to be able to use the values. This routine takes care
of that.
| |
CreateBoolProducerLambda |
Creates a bool producer lambda which is usable in projections via the ProjectionValueProducerFunc delegate.
| |
CreateConstantBoolPredicate |
Creates a constant false predicate. This predicate results in a @param=0 predicate, where the param has a value of 1.
| |
CreateDbFunctionCallAsLLBLExpression(DbFunctionCallExpression, IRelationCollection, Object) |
Creates a new DbFunctionCall object and wraps it inside a LLBLGenProExpressionExpression object.
| |
CreateDbFunctionCallAsLLBLExpression(Type, FunctionMapping, IRelationCollection, Object) |
Creates a new DbFunctionCall object and wraps it inside a LLBLGenProExpressionExpression object.
| |
CreateDerivedTable |
Creates a derived table definition from the expression to convert.
| |
CreateEntityInstanceFromEntityType |
Creates a new entity instance from the type specified. This routine uses a factory related to the type, not Activator, as some abstract entities
may be used which don't have a public ctor. Falls back to activator if type is a custom type derived from an entity class.
| |
CreateHashValueKeyFromIndices |
Creates the hash value key from indices.
| |
CreateObjectCreatorFuncInstanceTObject |
Creates the object creator func instance for instantiating objects of type TObject using the default constructor
| |
CreateObjectCreatorFuncInstanceTObject(ConstructorInfo) |
Creates the object creator func instance for instantiating objects of type TObject using the constructor passed in.
| |
CreatePkfieldPkFieldFilterFromEntity |
Creates a filter which compares the PK fields of the entity type passed in, for both aliases passed in, so:
aliasWrappedSet.PkField1 = aliasNestedSet.PkField1
AND
...
aliasWrappedSet.PkFieldn = aliasNestedSet.PkFieldn
| |
CreatePkFilterFromEntity |
Creates a pk filter on the PK fields of the passed in entity with the values in the passed in entity. The objectAlias is the alias of the set to filter.
| |
CreatePredicate(Object, ComparisonOperator, Object, ITemplateGroupSpecificCreator) |
Creates a predicate based on the imput specified.
| |
CreatePredicate(IEntityFieldCore, ComparisonOperator, Object, ITemplateGroupSpecificCreator) |
Creates a predicate based on the imput specified.
| |
CreatePredicateExpressionFromCorrelationRelation(IEntityRelation, ITemplateGroupSpecificCreator, MappingTracker) |
Creates a predicate expression from the correlation relation passed in. It aliases all fields to the start/end alias set, and creates
field compare field predicates (FieldCompareExpression instances) which are added with AND to the expression to return
| |
CreatePredicateExpressionFromCorrelationRelation(IEntityRelation, ITemplateGroupSpecificCreator, MappingTracker, ListIEntityFieldCore) |
Creates a predicate expression from the correlation relation passed in. It aliases all fields to the start/end alias set, and creates
field compare field predicates (FieldCompareExpression instances) which are added with AND to the expression to return
| |
CreateProjectionLambdaForTypedViewExpression |
Creates a p=>new T() { A = p.A, B=p.B, ...} expression for toWrap. Only fields of the typed view which have a corresponding
property in the return type of toWrap are considered.
| |
CreateProperReferenceFieldFromSourceFieldFromProjection |
Creates the proper reference field from source field from projection.
| |
CreateScalarQueryFromQueryExpression |
Creates a scalarqueryexpression object from the query passed in.
| |
CreateUsableDbFunctionCallParameterValue |
Creates a usable db function call parameter value from the expression passed in.
| |
DetermineComparisonOperatorForPredicate |
Determines the comparison operator for predicate from the operands passed in.
| |
DetermineDifferentValuesForNestedQueryFilter |
Determines the different values for nested query filter. This set of values is then used to build a parameterized query if possible.
| |
DetermineEntityTypeFromEntityCollectionType |
Determines the type of the entity type from entity collection.
| |
DetermineEntityTypeFromMemberExpression |
Gets the entity type from member. Assumes the member is either an entity or a collection and the member is defined on an entity
| |
DetermineEntityTypeFromSetExpression |
Determines the entity type from passed in set expression.
| |
DetermineEntityTypeFromType |
Determines the type of the entity type from the type passed in.
| |
DetermineInheritanceHierarchyTypeOfEntity |
Determines the inheritance hierarchy type of entity.
| |
DetermineSetElementType(Type) |
Determines the type of the elements in the set which type is passed in.
| |
DetermineSetElementType(Type, Boolean) |
Determines the type of the elements in the set which type is passed in.
| |
GetAllFieldsForEntity |
Gets all fields for entity.
| |
GetAllFieldsFromProjection |
Gets all fields from projection.
| |
GetAllPkFieldsOfEntity(IEntityCore, Boolean) |
Gets all the pk fields of entity.
| |
GetAllPkFieldsOfEntity(Type, IElementCreatorCore, Boolean) |
Gets all pk fields of entity.
| |
GetElementCreator |
Gets the element creator stored in the provider in the passed in queryable.
| |
GetEntityFactoryT |
Gets the entity factory for the entity type specified. Applies null checks with gracious error reporting for better clarity why it failed.
| |
GetEntityName |
Gets the name of the entity. If value is a string, value is returned as the string, if value is a type, GetEntityNameFromType
is used to obtain the name
| |
GetEntityNameFromType |
Gets the name of the entity of the entity which type has been passed in.
| |
GetEntityTypeEnumAsIntFromType |
Gets the EntityType enum value as integer of the entity with the type specified.
| |
GetFieldObject(IEntityCore, String) |
Gets the field object with the name passed in from the entity specified.
| |
GetFieldObject(IEntityCore, String, Boolean) |
Gets the field object with the name passed in from the entity specified.
| |
GetFieldObjectAndSetObjectAlias |
Gets the field object from the entity passed in and sets its ObjectAlias to the alias passed in.
| |
GetFirstFieldInProjection |
Gets the first field in projection.
| |
GetTypeOfValue |
Gets the type of value.
| |
GrabFirstUsuableFieldInProjection |
Grabs the first usable field in the projection definition passed in. For entity projections, this is the *last* field as due to inheritance
it can be the first field is in the root of the hierarchy. For the caller this shouldn't matter.
| |
IsNullableOfT |
Determines whether the passed in type is a nullable(Of T) type. If so, true is returned, otherwise false
| |
IsSingleValueType |
Determines whether the type passed in is a value type or a type which is a single value and thus should be considered a type a field could have.
| |
ObtainObjectValuesFromListOfObjects |
Obtains the object values for all fields in the list of fields specified from list of objects passed in.
| |
ObtainPkValuesFromListOfEntities |
Obtains the pk values from list of entities. It creates a new array, with listOfEntities.Count rows and fields.Count columns.
| |
ObtainRealValueFromConstantWrapped |
Obtains the real value from constant expression and wrap it again in a ConstantExpression. The 'real' value is the value of the object referred to
by the constant, e.g. an object property.
| |
ObtainTypeFilterForEntity |
Obtains the type filter for the entity with the type specified.
| |
ObtainValidFieldFromEntity(Type, IElementCreatorCore) |
Obtains a valid field from the entity of which the type is passed in. A valid field is a field which is located in that entity and also defined in that
entity so not inherited from a supertype.
| |
ObtainValidFieldFromEntity(Type, IElementCreatorCore, String) |
Obtains a valid field from the entity of which the type is passed in. A valid field is a field which is located in that entity and also defined in that
entity so not inherited from a supertype.
| |
ProduceBooleanProducerLambdaFromBooleanTypedExpression |
Produces the boolean producer lambda from boolean typed expression (which can be a filter or an LLBLGen expression with boolean operator)
boolean expression in projection means it has to be wrapped inside a scalarquery expression which should be wrapped inside a field which then
should be the parameter of a dbfunction call which represents a CASE statement. This db function call's result has to be processed by
a lambda which checks if the dbfunction call's case statement returned 1 or 0 and returns true or false.
| |
ProduceInvocationLambdaFromInvocationExpression |
Produces an invocation lambda from the invocation expression passed in.
It wraps the realLambda into a (values, indices) => realLambda(values[indexes[0]], values[indexes[1]], ...) call.
| |
ProduceProperBooleanExpressionLambda |
Produces the proper boolean expression lambda, from the passed in lambda. If the passed in lambda's return type isn't bool it's returned as-is.
Otherwise, it's checked whether it contains a boolean expression. If not, it's corrected. If it does, it's returned as-is.
| |
RemoveConvertExpressionWrappers |
Removes the convert expression wrappers, which are Unary expression which are simply Convert expression but don't do anything really useful.
| |
RemovePredicatesFromFilter |
Removes the passed in predicates from the filter to clean.
| |
RemoveUnaryQuoteExpressionWrappers |
Removes the unary quote expression wrappers. Some unary expressions are wrapped in Unary expressions which are of type Quote, and which
simply wrap an inner expression. This method unwraps the inner expression, as we're not interested in the wrapper.
| |
ReplaceFirstFieldInProjection |
Replaces the first field in project.
| |
SafeExpressionToString |
returns the string representation of the element passed in or "(null)" if null.
| |
SetProperHintForJoin |
Sets the proper hint for join in the relation passed in. It will set it to left join if the start entity is the fk side and the fk is nullable
it will set it to right join if the end entity is the fk side and the fk is nullable. If the FK side isn't nullable, and it's a 1:1 relationship,
the join hint will be towards the PK side: left or right. In all other cases it will stay Inner.
| |
StripOutProjectionFromJoinResultExpression |
Strips out the projection from join result expression.
| |
UnwrapNotExpression |
Unwraps the expression from the not expressions it is wrapped in and returns the unwrapped result, as well as the # of not expressions encountered.
| |
ValuesAreEqual |
Compares two values based on their values using the ORMSupportClasses routine in FieldUtilities. This method is here to avoid breakage of Linq code
without noticing it if the signature of the ORMSupportClasses routine changes. This routine has no code of its own, it simply calls into the
FieldUtilities.ValuesAreEqual routine
| |
WrapProjectionElementInSelectIfRequired |
Wraps the projection element in select passed in if required. This is necessary if the expression is an entity expression and it has a correlationrelation
which means that the projection element contains a reference to a related entity which will result in a nested query.
|