Class DataContextQueryProvider
A data context query provider base.
Inherited Members
Namespace: Kephas.Data.Linq
Assembly: Kephas.Data.dll
Syntax
public class DataContextQueryProvider : IDataContextQueryProvider, IAsyncQueryProvider, IQueryProvider
Constructors
| Improve this Doc View SourceDataContextQueryProvider(IQueryOperationContext, IQueryProvider)
Initializes a new instance of the DataContextQueryProvider class.
Declaration
public DataContextQueryProvider(IQueryOperationContext queryOperationContext, IQueryProvider nativeQueryProvider)
Parameters
Type | Name | Description |
---|---|---|
IQueryOperationContext | queryOperationContext | The query operation context. |
System.Linq.IQueryProvider | nativeQueryProvider | The native query provider. |
Properties
| Improve this Doc View SourceDataContext
Gets the bound data context.
Declaration
public IDataContext DataContext { get; }
Property Value
Type | Description |
---|---|
IDataContext | The bound data context. |
NativeQueryProvider
Gets the native query provider.
Declaration
public IQueryProvider NativeQueryProvider { get; }
Property Value
Type | Description |
---|---|
System.Linq.IQueryProvider | The native query provider. |
QueryOperationContext
Gets an operation context for the query.
Declaration
public IQueryOperationContext QueryOperationContext { get; }
Property Value
Type | Description |
---|---|
IQueryOperationContext | The query operation context. |
Methods
| Improve this Doc View SourceAttachEntitiesToDataContext<TResult>(TResult)
Attach entities to data context.
Declaration
protected virtual TResult AttachEntitiesToDataContext<TResult>(TResult executionResult)
Parameters
Type | Name | Description |
---|---|---|
TResult | executionResult | The execution result. |
Returns
Type | Description |
---|---|
TResult | The result containing attached entities. |
Type Parameters
Name | Description |
---|---|
TResult | The type of the value that results from executing the query. |
AttachEntityCollection<TResult, T>(TResult)
Attaches an entity collection.
Declaration
protected TResult AttachEntityCollection<TResult, T>(TResult executionResult)
where TResult : IEnumerable<T>
Parameters
Type | Name | Description |
---|---|---|
TResult | executionResult | The execution result. |
Returns
Type | Description |
---|---|
TResult | A list of attached entities. |
Type Parameters
Name | Description |
---|---|
TResult | Type of the result. |
T | The entity type. |
CreateQuery(Expression)
Constructs an System.Linq.IQueryable object that can evaluate the query represented by a specified expression tree.
Declaration
public virtual IQueryable CreateQuery(Expression expression)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.Expressions.Expression | expression | An expression tree that represents a LINQ query. |
Returns
Type | Description |
---|---|
System.Linq.IQueryable | An System.Linq.IQueryable that can evaluate the query represented by the specified expression tree. |
CreateQuery<TElement>(Expression)
Constructs an System.Linq.IQueryable<T> object that can evaluate the query represented by a specified expression tree.
Declaration
public virtual IQueryable<TElement> CreateQuery<TElement>(Expression expression)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.Expressions.Expression | expression | An expression tree that represents a LINQ query. |
Returns
Type | Description |
---|---|
System.Linq.IQueryable<TElement> | An System.Linq.IQueryable<T> that can evaluate the query represented by the specified expression tree. |
Type Parameters
Name | Description |
---|---|
TElement | The type of the elements of the System.Linq.IQueryable<T> that is returned. |
CreateQuery<TElement>(IQueryable<TElement>)
Constructs an System.Linq.IQueryable object that can evaluate the query represented by a specified expression tree.
Declaration
protected virtual IQueryable<TElement> CreateQuery<TElement>(IQueryable<TElement> nativeQuery)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.IQueryable<TElement> | nativeQuery | The native query. |
Returns
Type | Description |
---|---|
System.Linq.IQueryable<TElement> | An System.Linq.IQueryable that can evaluate the query represented by the specified expression tree. |
Type Parameters
Name | Description |
---|---|
TElement | The query element type. |
CreateQueryExpressionVisitor(Func<Type, IContext, Type>, IActivator)
Creates an expression visitor used to visit the query expression.
Declaration
protected virtual ExpressionVisitor CreateQueryExpressionVisitor(Func<Type, IContext, Type> implementationTypeResolver, IActivator activator)
Parameters
Type | Name | Description |
---|---|---|
System.Func<System.Type, IContext, System.Type> | implementationTypeResolver | The implementation type resolver. |
IActivator | activator | The activator. |
Returns
Type | Description |
---|---|
System.Linq.Expressions.ExpressionVisitor | The new query expression visitor. |
Execute(Expression)
Executes the query represented by a specified expression tree.
Declaration
public virtual object Execute(Expression expression)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.Expressions.Expression | expression | An expression tree that represents a LINQ query. |
Returns
Type | Description |
---|---|
System.Object | The value that results from executing the specified query. |
Execute<TResult>(Expression)
Executes the strongly-typed query represented by a specified expression tree.
Declaration
public virtual TResult Execute<TResult>(Expression expression)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.Expressions.Expression | expression | An expression tree that represents a LINQ query. |
Returns
Type | Description |
---|---|
TResult | The value that results from executing the specified query. |
Type Parameters
Name | Description |
---|---|
TResult | The type of the value that results from executing the query. |
ExecuteAsync(Expression, CancellationToken)
Asynchronously executes the query represented by a specified expression tree.
Declaration
public virtual Task<object> ExecuteAsync(Expression expression, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
System.Linq.Expressions.Expression | expression | An expression tree that represents a LINQ query. |
System.Threading.CancellationToken | cancellationToken | A System.Threading.CancellationToken to observe while waiting for the task to complete. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Object> | A task that represents the asynchronous operation. The task result contains the value that results from executing the specified query. |
ExecuteAsync<TResult>(Expression, CancellationToken)
Asynchronously executes the strongly-typed query represented by a specified expression tree.
Declaration
public virtual Task<TResult> ExecuteAsync<TResult>(Expression expression, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
System.Linq.Expressions.Expression | expression | An expression tree that represents a LINQ query. |
System.Threading.CancellationToken | cancellationToken | A System.Threading.CancellationToken to observe while waiting for the task to complete. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<TResult> | A task that represents the asynchronous operation. The task result contains the value that results from executing the specified query. |
Type Parameters
Name | Description |
---|---|
TResult | The type of the value that results from executing the query. |
GetExecutableExpression(Expression)
Prepares the provided expression for execution.
Declaration
protected virtual Expression GetExecutableExpression(Expression expression)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.Expressions.Expression | expression | An expression tree that represents a LINQ query. |
Returns
Type | Description |
---|---|
System.Linq.Expressions.Expression | An expression prepared for execution. |
IsAttachable(Object)
Indicates whether an entity is attachable.
Declaration
protected virtual bool IsAttachable(object entity)
Parameters
Type | Name | Description |
---|---|---|
System.Object | entity | The entity. |
Returns
Type | Description |
---|---|
System.Boolean | True if the entity is attachable, false if not. |
IsAttachableType(Type)
Indicates whether an entity type is attachable.
Declaration
protected virtual bool IsAttachableType(Type entityType)
Parameters
Type | Name | Description |
---|---|---|
System.Type | entityType | The entity type. |
Returns
Type | Description |
---|---|
System.Boolean | True if the entity type is attachable, false if not. |
ToExecutionResult<TResult, T>(IList<T>)
Converts the list of attached entities to an execution result.
Declaration
protected virtual TResult ToExecutionResult<TResult, T>(IList<T> attachedList)
where TResult : IEnumerable<T>
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IList<T> | attachedList | List of attached entities. |
Returns
Type | Description |
---|---|
TResult | The attached entity list as a TResult. |
Type Parameters
Name | Description |
---|---|
TResult | Type of the result. |
T | The item type. |
TryGetEntityActivator()
Tries to get the data context's entity activator.
Declaration
protected virtual IActivator TryGetEntityActivator()
Returns
Type | Description |
---|---|
IActivator | An IActivator. |