Class ParsingConfig
Configuration class for System.Linq.Dynamic.Core.
Inheritance
Inherited Members
Namespace: System.Linq.Dynamic.Core
Assembly: System.Linq.Dynamic.Core.dll
Syntax
public class ParsingConfig
Properties
| Improve this Doc View SourceAllowNewToEvaluateAnyType
Allows the New() keyword to evaluate any available Type.
Default value is false.
Declaration
public bool AllowNewToEvaluateAnyType { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
AreContextKeywordsEnabled
Determines if the context keywords (it, parent, and root) are valid and usable inside a Dynamic Linq string expression.
Does not affect the usability of the equivalent context symbols ($, ^ and ~).
Default value is false.
Declaration
public bool AreContextKeywordsEnabled { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
ConstantExpressionCacheConfig
Caches constant expressions to enhance performance. Periodic cleanup is performed to manage cache size, governed by this configuration.
Declaration
public CacheConfig ConstantExpressionCacheConfig { get; set; }
Property Value
| Type | Description |
|---|---|
| CacheConfig |
ConvertObjectToSupportComparison
Converts typeof(object) to the correct type to allow comparison (Equal, NotEqual, GreaterThan, GreaterThanEqual, LessThan and LessThanEqual).
Default value is false.
When set to
true, the following code will work correct:
class Person
{
public string Name { get; set; }
public object Age { get; set; }
}
var persons = new[]
{
new Person { Name = "Foo", Age = 99 },
new Person { Name = "Bar", Age = 33 }
}.AsQueryable();
var config = new ParsingConfig
{
ConvertObjectToSupportComparison = true
};
var results = persons.Where(config, "Age > 50").ToList();
Declaration
public bool ConvertObjectToSupportComparison { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
CustomTypeProvider
Gets or sets the IDynamicLinkCustomTypeProvider.
Declaration
public IDynamicLinkCustomTypeProvider CustomTypeProvider { get; set; }
Property Value
| Type | Description |
|---|---|
| IDynamicLinkCustomTypeProvider |
DateTimeIsParsedAsUTC
By default, a DateTime (like 'Fri, 10 May 2019 11:03:17 GMT') is parsed as local time. Use this flag to parse all DateTime strings as UTC.
Default value is false.
Declaration
public bool DateTimeIsParsedAsUTC { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
Default
Default ParsingConfig
Declaration
public static ParsingConfig Default { get; }
Property Value
| Type | Description |
|---|---|
| ParsingConfig |
DefaultCosmosDb
Default ParsingConfig for CosmosDb
Declaration
public static ParsingConfig DefaultCosmosDb { get; }
Property Value
| Type | Description |
|---|---|
| ParsingConfig |
DefaultEFCore21
Default ParsingConfig for EntityFramework Core 2.1 and higher
Declaration
public static ParsingConfig DefaultEFCore21 { get; }
Property Value
| Type | Description |
|---|---|
| ParsingConfig |
DisableMemberAccessToIndexAccessorFallback
By default, when a member is not found in a type and the type has a string based index accessor it will be parsed as an index accessor. Use this flag to disable this behaviour and have parsing fail when parsing an expression where a member access on a non-existing member happens.
Default value is false.
Declaration
public bool DisableMemberAccessToIndexAccessorFallback { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
DisallowNewKeyword
Disallows the New() keyword to be used to construct a class.
Default value is false.
Declaration
public bool DisallowNewKeyword { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
EvaluateGroupByAtDatabase
Gets or sets a value indicating whether the EntityFramework version supports evaluating GroupBy at database level.
See https://docs.microsoft.com/en-us/ef/core/what-is-new/ef-core-2.1#linq-groupby-translation
Remark: when this setting is set to true, make sure to supply this ParsingConfig as first parameter on the extension methods.
Default value is false.
Declaration
public bool EvaluateGroupByAtDatabase { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
ExpressionPromoter
Gets or sets the IExpressionPromoter.
Declaration
public IExpressionPromoter ExpressionPromoter { get; set; }
Property Value
| Type | Description |
|---|---|
| IExpressionPromoter |
IsCaseSensitive
Gets or sets if parameter, method, and properties resolution should be case-sensitive or not.
Default value is false.
Declaration
public bool IsCaseSensitive { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
LoadAdditionalAssembliesFromCurrentDomainBaseDirectory
Load additional assemblies from the current domain base directory. Note: only used when full .NET Framework and .NET Core App 2.x and higher.
Default value is false.
Declaration
public bool LoadAdditionalAssembliesFromCurrentDomainBaseDirectory { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
NullPropagatingUseDefaultValueForNonNullableValueTypes
When using the NullPropagating function np(...), use a "default value" for non-nullable value types instead of "null value".
Default value is false.
Declaration
public bool NullPropagatingUseDefaultValueForNonNullableValueTypes { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
NumberParseCulture
The number parsing culture.
Default value is CultureInfo.InvariantCulture
Declaration
public CultureInfo NumberParseCulture { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Globalization.CultureInfo |
PrioritizePropertyOrFieldOverTheType
When the type and property have the same name the parser takes the property instead of type when this setting is set to true.
This setting is also used for calling ExtensionMethods.
Default value is true.
Declaration
public bool PrioritizePropertyOrFieldOverTheType { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
QueryableAnalyzer
Gets or sets the IQueryableAnalyzer.
Declaration
public IQueryableAnalyzer QueryableAnalyzer { get; set; }
Property Value
| Type | Description |
|---|---|
| IQueryableAnalyzer |
RenameEmptyParameterExpressionNames
Prevents any System.Linq.Expressions.ParameterExpression.Name value from being empty by substituting a random 16 character word.
Default value is false.
Declaration
public bool RenameEmptyParameterExpressionNames { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
RenameParameterExpression
Renames the (Typed)ParameterExpression empty Name to the correct supplied name from it.
Default value is false.
Declaration
public bool RenameParameterExpression { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
ResolveTypesBySimpleName
By default, finding types by a simple name is not supported. Use this flag to use the CustomTypeProvider to resolve types by a simple name like "Employee" instead of "MyDatabase.Entities.Employee". Note that a first matching type is returned and this functionality needs to scan all types from all assemblies, so use with caution.
Default value is false.
Declaration
public bool ResolveTypesBySimpleName { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
StringLiteralParsing
Defines the type of string literal parsing that will be performed.
Default value is StringLiteralParsingType.Default.
Declaration
public StringLiteralParsingType StringLiteralParsing { get; set; }
Property Value
| Type | Description |
|---|---|
| StringLiteralParsingType |
SupportCastingToFullyQualifiedTypeAsString
Support casting to a full qualified type using a string (double-quoted value).
var result = queryable.Select($"\"System.DateTime\"(LastUpdate)");
Default value is true.
Declaration
public bool SupportCastingToFullyQualifiedTypeAsString { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
SupportDotInPropertyNames
Support a "." in a property-name. Used in the 'new (a.b as a.b)' syntax.
Default value is false.
Declaration
public bool SupportDotInPropertyNames { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
SupportEnumerationsFromSystemNamespace
Support enumeration-types from the System namespace in mscorlib. An example could be "StringComparison".
Default value is true.
Declaration
public bool SupportEnumerationsFromSystemNamespace { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
TypeConverters
Additional TypeConverters
Declaration
public IDictionary<Type, TypeConverter> TypeConverters { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Collections.Generic.IDictionary<System.Type, System.ComponentModel.TypeConverter> |
UseParameterizedNamesInDynamicQuery
Use Parameterized Names in generated dynamic SQL query. See https://github.com/graeme-hill/gblog/blob/master/source_content/articles/2014.139_entity-framework-dynamic-queries-and-parameterization.mkd
Default value is false.
Declaration
public bool UseParameterizedNamesInDynamicQuery { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |