TdsQueryEngineOptions Class

Configures the built-in TDS query engine.

public sealed class TdsQueryEngineOptions

Remarks

Configure the instance fully before passing it to TdsQueryEngine.CreateQueryHandler. The collections are snapshotted at that point, so later additions are ignored, and mutating them afterwards races with queries running on other connections.

Constructors

NameDescription
TdsQueryEngineOptions()Initializes a new instance of the TdsQueryEngineOptions class with the default scalar functions.

TdsQueryEngineOptions()

TdsQueryEngineOptions.cs

Initializes a new instance of the TdsQueryEngineOptions class with the default scalar functions.

[RequiresDynamicCode("The query engine compiles LINQ expression trees and creates projection types and generic instantiations at run time.")]
[RequiresUnreferencedCode("The query engine translates SQL into LINQ expression trees and reads the members of the query roots and stored procedures with reflection.")]
public TdsQueryEngineOptions()

Properties

NameDescription
IsAuthorizedGets or sets the authorization callback used for stored procedures and query roots.
MaterializeAsyncGets or sets the materializer used to enumerate translated text queries.
NotAuthorizedErrorFactoryGets or sets the factory used to build permission-denied errors.
QueryRootsGets the query roots available to SQL text queries.
ScalarFunctionsGets the scalar SQL function mappings used by the query translator.
StoredProceduresGets the stored procedures available to RPC requests.
XmlSchemaCollectionsGets the XML schema collections available to typed XML casts.

Gets or sets the authorization callback used for stored procedures and query roots.

public TdsQueryEngineAuthorizationHandler IsAuthorized { get; set; }

MaterializeAsync

TdsQueryEngineOptions.cs

Gets or sets the materializer used to enumerate translated text queries.

public TdsQueryMaterializer MaterializeAsync { get; set; }

Property value

TdsQueryMaterializer

NotAuthorizedErrorFactory

TdsQueryEngineOptions.cs

Gets or sets the factory used to build permission-denied errors.

public Func<TdsQueryContext, TdsQueryEngineResourceKind, string, TdsQueryError> NotAuthorizedErrorFactory { get; set; }

Gets the query roots available to SQL text queries.

public Collection<TdsQueryRoot> QueryRoots { get; }

Gets the scalar SQL function mappings used by the query translator.

public IDictionary<string, TdsQueryScalarFunction> ScalarFunctions { get; }

StoredProcedures

TdsQueryEngineOptions.cs

Gets the stored procedures available to RPC requests.

public IDictionary<string, Delegate> StoredProcedures { get; }

Property value

IDictionary<string, Delegate>

Remarks

Stored procedure delegates can declare parameters matching RPC parameters, plus optional injected TdsQueryContext and CancellationToken parameters.

XmlSchemaCollections

TdsQueryEngineOptions.cs

Gets the XML schema collections available to typed XML casts.

public IDictionary<string, XmlSchemaSet> XmlSchemaCollections { get; }

Methods

NameDescription
AddQueryRoot<T>(string, Func<TdsQueryContext, IQueryable<T>>)Adds a query root factory resolved from the current query request context.
AddScalarFunction(string, TdsQueryScalarFunction)Adds or replaces a scalar SQL function mapping.
AddXmlSchemaCollection(string, string)Adds or replaces an XML schema collection from an XSD definition string.
AddXmlSchemaCollection(string, XmlSchemaSet)Adds or replaces an XML schema collection.

AddQueryRoot<T>(string, Func<TdsQueryContext, IQueryable<T>>)

TdsQueryEngineOptions.cs

Adds a query root factory resolved from the current query request context.

public TdsQueryEngineOptions AddQueryRoot<T>(string name, Func<TdsQueryContext, IQueryable<T>> queryFactory)

Type parameters

T

Parameters

name string
queryFactory Func<TdsQueryContext, IQueryable<T>>

Returns

TdsQueryEngineOptions

AddScalarFunction(string, TdsQueryScalarFunction)

TdsQueryEngineOptions.cs

Adds or replaces a scalar SQL function mapping.

public TdsQueryEngineOptions AddScalarFunction(string name, TdsQueryScalarFunction function)

AddXmlSchemaCollection overloads

AddXmlSchemaCollection(string, string)

TdsQueryEngineOptions.cs

Adds or replaces an XML schema collection from an XSD definition string.

public TdsQueryEngineOptions AddXmlSchemaCollection(string name, string schemaDefinition)
Parameters
name string
schemaDefinition string
Returns

TdsQueryEngineOptions

AddXmlSchemaCollection(string, XmlSchemaSet)

TdsQueryEngineOptions.cs

Adds or replaces an XML schema collection.

public TdsQueryEngineOptions AddXmlSchemaCollection(string name, XmlSchemaSet schemaSet)
Parameters
name string
schemaSet XmlSchemaSet
Returns

TdsQueryEngineOptions