Class QueryableExecuterExtensions
These make the rest of the code base a lot easier to read. Instead of:
(await con.ExecuteQuery(GetItems{T}().Where().Where())).ToArray();
You can write:
await con.GetItems{T}()
.Where()
.Where()
.ExecuteAsArray(con);
Inherited Members
Namespace: LemonEdge.API.Core.Data
Assembly: LemonEdge.API.dll
Syntax
public static class QueryableExecuterExtensions
Methods
Execute(QueryableExecuter, IEntityRetriever, CancellationToken)
Executes the current QueryableExecuter using the provided IEntityRetriever.
Declaration
public static Task<IEnumerable<IBaseEntity>> Execute(this QueryableExecuter source, IEntityRetriever context, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
QueryableExecuter | source | This QueryableExecuter |
IEntityRetriever | context | The context from which to fetch |
CancellationToken | cancellationToken | A cancellation token |
Returns
Type | Description |
---|---|
Task<IEnumerable<IBaseEntity>> | A Task of IEnumerable of IBaseEntity |
ExecuteAny<T>(QueryableExecuter<T>, IEntityRetriever, Func<T, bool>, CancellationToken)
Executes the current QueryableExecuter using the provided IEntityRetriever, and calls Any(predicate) on the result.
Declaration
public static Task<bool> ExecuteAny<T>(this QueryableExecuter<T> source, IEntityRetriever context, Func<T, bool> predicate, CancellationToken cancellationToken = default) where T : IBaseEntity
Parameters
Type | Name | Description |
---|---|---|
QueryableExecuter<T> | source | This QueryableExecuter |
IEntityRetriever | context | The context from which to fetch |
Func<T, bool> | predicate | The predicate |
CancellationToken | cancellationToken | A cancellation token |
Returns
Type | Description |
---|---|
Task<bool> | A T where T is an IBaseEntity |
Type Parameters
Name | Description |
---|---|
T |
ExecuteAny<T>(QueryableExecuter<T>, IEntityRetriever, CancellationToken)
Executes the current QueryableExecuter using the provided IEntityRetriever, and calls Any() on the result.
Declaration
public static Task<bool> ExecuteAny<T>(this QueryableExecuter<T> source, IEntityRetriever context, CancellationToken cancellationToken = default) where T : IBaseEntity
Parameters
Type | Name | Description |
---|---|---|
QueryableExecuter<T> | source | This QueryableExecuter |
IEntityRetriever | context | The context from which to fetch |
CancellationToken | cancellationToken | A cancellation token |
Returns
Type | Description |
---|---|
Task<bool> | A T where T is an IBaseEntity |
Type Parameters
Name | Description |
---|---|
T |
ExecuteAsArray(QueryableExecuter, IEntityRetriever, CancellationToken)
Executes the current QueryableExecuter using the provided IEntityRetriever as an array.
Declaration
public static Task<IBaseEntity[]> ExecuteAsArray(this QueryableExecuter source, IEntityRetriever context, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
QueryableExecuter | source | This QueryableExecuter |
IEntityRetriever | context | The context from which to fetch |
CancellationToken | cancellationToken | A cancellation token |
Returns
Type | Description |
---|---|
Task<IBaseEntity[]> | A Task of IBaseEntity[] |
ExecuteAsArray<T>(QueryableExecuter<T>, IEntityRetriever, CancellationToken)
Executes the current QueryableExecuter using the provided IEntityRetriever as an array.
Declaration
public static Task<T[]> ExecuteAsArray<T>(this QueryableExecuter<T> source, IEntityRetriever context, CancellationToken cancellationToken = default) where T : IBaseEntity
Parameters
Type | Name | Description |
---|---|---|
QueryableExecuter<T> | source | This QueryableExecuter |
IEntityRetriever | context | The context from which to fetch |
CancellationToken | cancellationToken | A cancellation token |
Returns
Type | Description |
---|---|
Task<T[]> | A Task of T[], where T is IBaseEntity |
Type Parameters
Name | Description |
---|---|
T | The type of BaseEntity |
ExecuteAsList(QueryableExecuter, IEntityRetriever, CancellationToken)
Executes the current QueryableExecuter using the provided IEntityRetriever as a list.
Declaration
public static Task<List<IBaseEntity>> ExecuteAsList(this QueryableExecuter source, IEntityRetriever context, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
QueryableExecuter | source | This QueryableExecuter |
IEntityRetriever | context | The context from which to fetch |
CancellationToken | cancellationToken | A cancellation token |
Returns
Type | Description |
---|---|
Task<List<IBaseEntity>> | A Task of List of IBaseEntity |
ExecuteAsList<T>(QueryableExecuter<T>, IEntityRetriever, CancellationToken)
Executes the current QueryableExecuter using the provided IEntityRetriever as a list.
Declaration
public static Task<List<T>> ExecuteAsList<T>(this QueryableExecuter<T> source, IEntityRetriever context, CancellationToken cancellationToken = default) where T : IBaseEntity
Parameters
Type | Name | Description |
---|---|---|
QueryableExecuter<T> | source | This QueryableExecuter |
IEntityRetriever | context | The context from which to fetch |
CancellationToken | cancellationToken | A cancellation token |
Returns
Type | Description |
---|---|
Task<List<T>> | A Task of List of T, where T is IBaseEntity |
Type Parameters
Name | Description |
---|---|
T | The type of BaseEntity |
ExecuteFirst(QueryableExecuter, IEntityRetriever, CancellationToken)
Executes the current QueryableExecuter using the provided IEntityRetriever, and calls First() on the result.
Declaration
public static Task<IBaseEntity> ExecuteFirst(this QueryableExecuter source, IEntityRetriever context, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
QueryableExecuter | source | This QueryableExecuter |
IEntityRetriever | context | The context from which to fetch |
CancellationToken | cancellationToken | A cancellation token |
Returns
Type | Description |
---|---|
Task<IBaseEntity> | An IBaseEntity |
ExecuteFirstOrDefault(QueryableExecuter, IEntityRetriever, CancellationToken)
Executes the current QueryableExecuter using the provided IEntityRetriever, and calls FirstOrDefault() on the result.
Declaration
public static Task<IBaseEntity> ExecuteFirstOrDefault(this QueryableExecuter source, IEntityRetriever context, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
QueryableExecuter | source | This QueryableExecuter |
IEntityRetriever | context | The context from which to fetch |
CancellationToken | cancellationToken | A cancellation token |
Returns
Type | Description |
---|---|
Task<IBaseEntity> | An IBaseEntity |
ExecuteFirstOrDefault<T>(QueryableExecuter<T>, IEntityRetriever, CancellationToken)
Executes the current QueryableExecuter using the provided IEntityRetriever, and calls FirstOrDefault() on the result.
Declaration
public static Task<T> ExecuteFirstOrDefault<T>(this QueryableExecuter<T> source, IEntityRetriever context, CancellationToken cancellationToken = default) where T : IBaseEntity
Parameters
Type | Name | Description |
---|---|---|
QueryableExecuter<T> | source | This QueryableExecuter |
IEntityRetriever | context | The context from which to fetch |
CancellationToken | cancellationToken | A cancellation token |
Returns
Type | Description |
---|---|
Task<T> | A T where T is an IBaseEntity |
Type Parameters
Name | Description |
---|---|
T |
ExecuteFirst<T>(QueryableExecuter<T>, IEntityRetriever, CancellationToken)
Executes the current QueryableExecuter using the provided IEntityRetriever, and calls First() on the result.
Declaration
public static Task<T> ExecuteFirst<T>(this QueryableExecuter<T> source, IEntityRetriever context, CancellationToken cancellationToken = default) where T : IBaseEntity
Parameters
Type | Name | Description |
---|---|---|
QueryableExecuter<T> | source | This QueryableExecuter |
IEntityRetriever | context | The context from which to fetch |
CancellationToken | cancellationToken | A cancellation token |
Returns
Type | Description |
---|---|
Task<T> | A T where T is an IBaseEntity |
Type Parameters
Name | Description |
---|---|
T |
Execute<T>(QueryableExecuter<T>, IEntityRetriever, CancellationToken)
Executes the current QueryableExecuter using the provided IEntityRetriever.
Declaration
public static Task<IEnumerable<T>> Execute<T>(this QueryableExecuter<T> source, IEntityRetriever context, CancellationToken cancellationToken = default) where T : IBaseEntity
Parameters
Type | Name | Description |
---|---|---|
QueryableExecuter<T> | source | This QueryableExecuter |
IEntityRetriever | context | The context from which to fetch |
CancellationToken | cancellationToken | A cancellation token |
Returns
Type | Description |
---|---|
Task<IEnumerable<T>> | A Task of IEnumerable of T, where T is IBaseEntity |
Type Parameters
Name | Description |
---|---|
T | The type of BaseEntity |