Interface IEntityViewRepository<TEntityView>
- Namespace
- GroupeIsa.Neos.Application.Persistence
- Assembly
- GroupeIsa.Neos.Application.Abstractions.dll
Provides the functionalities of an entity view persistence.
public interface IEntityViewRepository<TEntityView> : IEntityViewRepository where TEntityView : class, IEntityView
Type Parameters
TEntityViewThe entity view type.
- Inherited Members
Properties
SearchExpression
Gets or sets search expression.
[Obsolete("Use IEntityViewRepositoryContext<TEntityView>.SetUIViewName method instead.")]
Expression<Func<TEntityView, string, bool>>? SearchExpression { get; set; }
Property Value
- Expression<Func<TEntityView, string, bool>>
Methods
Add(TEntityView)
Adds an item.
void Add(TEntityView entityView)
Parameters
entityViewTEntityViewThe entity view item.
AddNew()
Adds a new item.
TEntityView AddNew()
Returns
- TEntityView
The entity view item.
CountAsync(EntityViewParameters<TEntityView>, Func<IQueryable<TEntityView>, IQueryable<TEntityView>>?, CancellationToken)
Counts the number of elements matching the condition.
Task<long> CountAsync(EntityViewParameters<TEntityView> parameters, Func<IQueryable<TEntityView>, IQueryable<TEntityView>>? queryCustomization = null, CancellationToken cancellationToken = default)
Parameters
parametersEntityViewParameters<TEntityView>Parameters.
queryCustomizationFunc<IQueryable<TEntityView>, IQueryable<TEntityView>>Query customization.
cancellationTokenCancellationTokenThe cancellation token.
Returns
CountAsync(Func<IQueryable<TEntityView>, IQueryable<TEntityView>>?, CancellationToken)
Count the number of elements matching the query.
Task<long> CountAsync(Func<IQueryable<TEntityView>, IQueryable<TEntityView>>? queryCustomization = null, CancellationToken cancellationToken = default)
Parameters
queryCustomizationFunc<IQueryable<TEntityView>, IQueryable<TEntityView>>The query customization.
cancellationTokenCancellationTokenThe cancellation token.
Returns
Delete(TEntityView)
Deletes an item.
void Delete(TEntityView entityView)
Parameters
entityViewTEntityViewThe item.
DeleteAsync(object, CancellationToken)
Deletes an item.
Task<Result> DeleteAsync(object key, CancellationToken cancellationToken = default)
Parameters
keyobjectThe item key.
cancellationTokenCancellationTokenA CancellationToken that can be used to cancel the operation.
Returns
- Task<Result>
True if the item was found and deleted, false elsewhere.
FindAsync(object)
Finds an entity view with the given primary key. If an entity view with the given primary key values is being tracked by the context, then it is returned immediately without making a request to the storage. Otherwise, a query is made to the storage for an entity view with the given primary key and this entity view, if found, is attached to the context and returned. If no entity view is found, then null is returned.
Task<TEntityView?> FindAsync(object key)
Parameters
keyobjectThe key.
Returns
- Task<TEntityView>
The entity view found, or null.
FindAsync(object, EntityViewParameters<TEntityView>)
Finds an entity view with the given primary key. If an entity view with the given primary key values is being tracked by the context, then it is returned immediately without making a request to the storage. Otherwise, a query is made to the storage for an entity view with the given primary key and this entity view, if found, is attached to the context and returned. If no entity view is found, then null is returned.
Task<TEntityView?> FindAsync(object key, EntityViewParameters<TEntityView> parameters)
Parameters
keyobjectThe key.
parametersEntityViewParameters<TEntityView>Parameters.
Returns
- Task<TEntityView>
The entity view found, or null.
FindAsync(object, EntityViewParameters<TEntityView>, AdditionalDataExpressions)
Finds an entity view with the given primary key. If an entity view with the given primary key values is being tracked by the context, then it is returned immediately without making a request to the storage. Otherwise, a query is made to the storage for an entity view with the given primary key and this entity view, if found, is attached to the context and returned. If no entity view is found, then null is returned.
[Obsolete("Use IEntityViewRepositoryContext<TEntityView>.SetUIViewName method instead.")]
Task<TEntityView?> FindAsync(object key, EntityViewParameters<TEntityView> parameters, AdditionalDataExpressions additionalDataExpressions)
Parameters
keyobjectThe key.
parametersEntityViewParameters<TEntityView>Parameters.
additionalDataExpressionsAdditionalDataExpressionsThe expressions to retrieve additional data.
Returns
- Task<TEntityView>
The entity view found, or null.
FindAsync(object, EntityViewParameters<TEntityView>, AdditionalDataExpressions, CancellationToken)
Finds an entity view with the given primary key. If an entity view with the given primary key values is being tracked by the context, then it is returned immediately without making a request to the storage. Otherwise, a query is made to the storage for an entity view with the given primary key and this entity view, if found, is attached to the context and returned. If no entity view is found, then null is returned.
[Obsolete("Use IEntityViewRepositoryContext<TEntityView>.SetUIViewName method instead.")]
Task<TEntityView?> FindAsync(object key, EntityViewParameters<TEntityView> parameters, AdditionalDataExpressions additionalDataExpressions, CancellationToken cancellationToken)
Parameters
keyobjectThe key.
parametersEntityViewParameters<TEntityView>Parameters.
additionalDataExpressionsAdditionalDataExpressionsThe expressions to retrieve additional data.
cancellationTokenCancellationTokenA CancellationToken that can be used to cancel the operation.
Returns
- Task<TEntityView>
The entity view found, or null.
FindAsync(object, EntityViewParameters<TEntityView>, Func<IQueryable<TEntityView>, IQueryable<TEntityView>>?, CancellationToken)
Finds an entity view with the given primary key. If an entity view with the given primary key values is being tracked by the context, then it is returned immediately without making a request to the storage. Otherwise, a query is made to the storage for an entity view with the given primary key and this entity view, if found, is attached to the context and returned. If no entity view is found, then null is returned.
Task<TEntityView?> FindAsync(object key, EntityViewParameters<TEntityView> parameters, Func<IQueryable<TEntityView>, IQueryable<TEntityView>>? queryCustomization, CancellationToken cancellationToken)
Parameters
keyobjectThe key.
parametersEntityViewParameters<TEntityView>Parameters.
queryCustomizationFunc<IQueryable<TEntityView>, IQueryable<TEntityView>>Query customization.
cancellationTokenCancellationTokenA CancellationToken that can be used to cancel the operation.
Returns
- Task<TEntityView>
The entity view found, or null.
FindAsync(object, EntityViewParameters<TEntityView>, CancellationToken)
Finds an entity view with the given primary key. If an entity view with the given primary key values is being tracked by the context, then it is returned immediately without making a request to the storage. Otherwise, a query is made to the storage for an entity view with the given primary key and this entity view, if found, is attached to the context and returned. If no entity view is found, then null is returned.
Task<TEntityView?> FindAsync(object key, EntityViewParameters<TEntityView> parameters, CancellationToken cancellationToken)
Parameters
keyobjectThe key.
parametersEntityViewParameters<TEntityView>Parameters.
cancellationTokenCancellationTokenA CancellationToken that can be used to cancel the operation.
Returns
- Task<TEntityView>
The entity view found, or null.
FindAsync(object, AdditionalDataExpressions)
Finds an entity view with the given primary key. If an entity view with the given primary key values is being tracked by the context, then it is returned immediately without making a request to the storage. Otherwise, a query is made to the storage for an entity view with the given primary key and this entity view, if found, is attached to the context and returned. If no entity view is found, then null is returned.
[Obsolete("Use IEntityViewRepositoryContext<TEntityView>.SetUIViewName method instead.")]
Task<TEntityView?> FindAsync(object key, AdditionalDataExpressions additionalDataExpressions)
Parameters
keyobjectThe key.
additionalDataExpressionsAdditionalDataExpressionsThe expressions to retrieve additional data.
Returns
- Task<TEntityView>
The entity view found, or null.
FindAsync(object, AdditionalDataExpressions, CancellationToken)
Finds an entity view with the given primary key. If an entity view with the given primary key values is being tracked by the context, then it is returned immediately without making a request to the storage. Otherwise, a query is made to the storage for an entity view with the given primary key and this entity view, if found, is attached to the context and returned. If no entity view is found, then null is returned.
[Obsolete("Use IEntityViewRepositoryContext<TEntityView>.SetUIViewName method instead.")]
Task<TEntityView?> FindAsync(object key, AdditionalDataExpressions additionalDataExpressions, CancellationToken cancellationToken)
Parameters
keyobjectThe key.
additionalDataExpressionsAdditionalDataExpressionsThe expressions to retrieve additional data.
cancellationTokenCancellationTokenA CancellationToken that can be used to cancel the operation.
Returns
- Task<TEntityView>
The entity view found, or null.
FindAsync(object, CancellationToken)
Finds an entity view with the given primary key. If an entity view with the given primary key values is being tracked by the context, then it is returned immediately without making a request to the storage. Otherwise, a query is made to the storage for an entity view with the given primary key and this entity view, if found, is attached to the context and returned. If no entity view is found, then null is returned.
Task<TEntityView?> FindAsync(object key, CancellationToken cancellationToken)
Parameters
keyobjectThe key.
cancellationTokenCancellationTokenA CancellationToken that can be used to cancel the operation.
Returns
- Task<TEntityView>
The entity view found, or null.
GetAsync(object)
Gets an entity view with the given primary key. If an entity view with the given primary key values is being tracked by the context, then it is returned immediately without making a request to the storage. Otherwise, a query is made to the storage for an entity view with the given primary key and this entity view, if found, is attached to the context and returned.
Task<TEntityView> GetAsync(object key)
Parameters
keyobjectThe key.
Returns
- Task<TEntityView>
The entity view found.
Exceptions
- InvalidOperationException
There is no entity view with the given primary key values.
GetAsync(object, EntityViewParameters<TEntityView>)
Gets an entity view with the given primary key. If an entity view with the given primary key values is being tracked by the context, then it is returned immediately without making a request to the storage. Otherwise, a query is made to the storage for an entity view with the given primary key and this entity view, if found, is attached to the context and returned.
Task<TEntityView> GetAsync(object key, EntityViewParameters<TEntityView> parameters)
Parameters
keyobjectThe key.
parametersEntityViewParameters<TEntityView>Parameters.
Returns
- Task<TEntityView>
The entity view found.
Exceptions
- InvalidOperationException
There is no entity view with the given primary key values.
GetAsync(object, EntityViewParameters<TEntityView>, AdditionalDataExpressions)
Gets an entity view with the given primary key. If an entity view with the given primary key values is being tracked by the context, then it is returned immediately without making a request to the storage. Otherwise, a query is made to the storage for an entity view with the given primary key and this entity view, if found, is attached to the context and returned.
[Obsolete("Use IEntityViewRepositoryContext<TEntityView>.SetUIViewName method instead.")]
Task<TEntityView> GetAsync(object key, EntityViewParameters<TEntityView> parameters, AdditionalDataExpressions additionalDataExpressions)
Parameters
keyobjectThe key.
parametersEntityViewParameters<TEntityView>Parameters.
additionalDataExpressionsAdditionalDataExpressionsThe expressions to retrieve additional data.
Returns
- Task<TEntityView>
The entity view found.
Exceptions
- InvalidOperationException
There is no entity view with the given primary key values.
GetAsync(object, EntityViewParameters<TEntityView>, AdditionalDataExpressions, CancellationToken)
Gets an entity view with the given primary key. If an entity view with the given primary key values is being tracked by the context, then it is returned immediately without making a request to the storage. Otherwise, a query is made to the storage for an entity view with the given primary key and this entity view, if found, is attached to the context and returned.
[Obsolete("Use IEntityViewRepositoryContext<TEntityView>.SetUIViewName method instead.")]
Task<TEntityView> GetAsync(object key, EntityViewParameters<TEntityView> parameters, AdditionalDataExpressions additionalDataExpressions, CancellationToken cancellationToken)
Parameters
keyobjectThe key.
parametersEntityViewParameters<TEntityView>Parameters.
additionalDataExpressionsAdditionalDataExpressionsThe expressions to retrieve additional data.
cancellationTokenCancellationTokenA CancellationToken that can be used to cancel the operation.
Returns
- Task<TEntityView>
The entity view found.
Exceptions
- InvalidOperationException
There is no entity view with the given primary key values.
GetAsync(object, EntityViewParameters<TEntityView>, CancellationToken)
Gets an entity view with the given primary key. If an entity view with the given primary key values is being tracked by the context, then it is returned immediately without making a request to the storage. Otherwise, a query is made to the storage for an entity view with the given primary key and this entity view, if found, is attached to the context and returned.
Task<TEntityView> GetAsync(object key, EntityViewParameters<TEntityView> parameters, CancellationToken cancellationToken)
Parameters
keyobjectThe key.
parametersEntityViewParameters<TEntityView>Parameters.
cancellationTokenCancellationTokenA CancellationToken that can be used to cancel the operation.
Returns
- Task<TEntityView>
The entity view found.
Exceptions
- InvalidOperationException
There is no entity view with the given primary key values.
GetAsync(object, AdditionalDataExpressions)
Gets an entity view with the given primary key. If an entity view with the given primary key values is being tracked by the context, then it is returned immediately without making a request to the storage. Otherwise, a query is made to the storage for an entity view with the given primary key and this entity view, if found, is attached to the context and returned.
[Obsolete("Use IEntityViewRepositoryContext<TEntityView>.SetUIViewName method instead.")]
Task<TEntityView> GetAsync(object key, AdditionalDataExpressions additionalDataExpressions)
Parameters
keyobjectThe key.
additionalDataExpressionsAdditionalDataExpressionsThe expressions to retrieve additional data.
Returns
- Task<TEntityView>
The entity view found.
Exceptions
- InvalidOperationException
There is no entity view with the given primary key values.
GetAsync(object, AdditionalDataExpressions, CancellationToken)
Gets an entity view with the given primary key. If an entity view with the given primary key values is being tracked by the context, then it is returned immediately without making a request to the storage. Otherwise, a query is made to the storage for an entity view with the given primary key and this entity view, if found, is attached to the context and returned.
[Obsolete("Use IEntityViewRepositoryContext<TEntityView>.SetUIViewName method instead.")]
Task<TEntityView> GetAsync(object key, AdditionalDataExpressions additionalDataExpressions, CancellationToken cancellationToken)
Parameters
keyobjectThe key.
additionalDataExpressionsAdditionalDataExpressionsThe expressions to retrieve additional data.
cancellationTokenCancellationTokenA CancellationToken that can be used to cancel the operation.
Returns
- Task<TEntityView>
The entity view found.
Exceptions
- InvalidOperationException
There is no entity view with the given primary key values.
GetAsync(object, CancellationToken)
Gets an entity view with the given primary key. If an entity view with the given primary key values is being tracked by the context, then it is returned immediately without making a request to the storage. Otherwise, a query is made to the storage for an entity view with the given primary key and this entity view, if found, is attached to the context and returned.
Task<TEntityView> GetAsync(object key, CancellationToken cancellationToken)
Parameters
keyobjectThe key.
cancellationTokenCancellationTokenA CancellationToken that can be used to cancel the operation.
Returns
- Task<TEntityView>
The entity view found.
Exceptions
- InvalidOperationException
There is no entity view with the given primary key values.
GetKey(TEntityView)
Gets the key from an entity view.
object GetKey(TEntityView entityView)
Parameters
entityViewTEntityViewEntity view.
Returns
- object
The key.
GetListAsync()
Gets entity view items.
Task<IReadOnlyList<TEntityView>> GetListAsync()
Returns
- Task<IReadOnlyList<TEntityView>>
The entity view items.
GetListAsync(EntityViewParameters<TEntityView>)
Gets entity view items.
Task<IReadOnlyList<TEntityView>> GetListAsync(EntityViewParameters<TEntityView> parameters)
Parameters
parametersEntityViewParameters<TEntityView>Parameters.
Returns
- Task<IReadOnlyList<TEntityView>>
The entity view items.
Examples
The following example shows how to get all daily orders and display them.
IReadOnlyList<IOrderView> dailyOrders = await EntityViewRepositories.OrderView.GetListAsync(e => e.Where(o => o.OrderDate < DateTime.Today));
foreach (IOrderView order in dailyOrders)
{
Console.WriteLine($"Id : {order.OrderId}, Date : {order.OrderDate}");
}
Remarks
The items are first searched in cache. The items not found in cache are then retrieved from the storage.
GetListAsync(EntityViewParameters<TEntityView>, AdditionalDataExpressions)
Gets entity view items.
[Obsolete("Use IEntityViewRepositoryContext<TEntityView>.SetUIViewName method instead.")]
Task<IReadOnlyList<TEntityView>> GetListAsync(EntityViewParameters<TEntityView> parameters, AdditionalDataExpressions additionalDataExpressions)
Parameters
parametersEntityViewParameters<TEntityView>Parameters.
additionalDataExpressionsAdditionalDataExpressionsThe expressions to retrieve additional data.
Returns
- Task<IReadOnlyList<TEntityView>>
The entity view items.
Examples
The following example shows how to get all daily orders and display them.
IReadOnlyList<IOrderView> dailyOrders = await EntityViewRepositories.OrderView.GetListAsync(e => e.Where(o => o.OrderDate < DateTime.Today));
foreach (IOrderView order in dailyOrders)
{
Console.WriteLine($"Id : {order.OrderId}, Date : {order.OrderDate}");
}
Remarks
The items are first searched in cache. The items not found in cache are then retrieved from the storage.
GetListAsync(EntityViewParameters<TEntityView>, AdditionalDataExpressions, Func<IQueryable<TEntityView>, IQueryable<TEntityView>>?)
Gets entity view items.
[Obsolete("Use IEntityViewRepositoryContext<TEntityView>.SetUIViewName method instead.")]
Task<IReadOnlyList<TEntityView>> GetListAsync(EntityViewParameters<TEntityView> parameters, AdditionalDataExpressions additionalDataExpressions, Func<IQueryable<TEntityView>, IQueryable<TEntityView>>? queryCustomization)
Parameters
parametersEntityViewParameters<TEntityView>Parameters.
additionalDataExpressionsAdditionalDataExpressionsThe expressions to retrieve additional data.
queryCustomizationFunc<IQueryable<TEntityView>, IQueryable<TEntityView>>Query customization.
Returns
- Task<IReadOnlyList<TEntityView>>
The entity view items.
Examples
The following example shows how to get all daily orders and display them.
IReadOnlyList<IOrderView> dailyOrders = await EntityViewRepositories.OrderView.GetListAsync(e => e.Where(o => o.OrderDate < DateTime.Today));
foreach (IOrderView order in dailyOrders)
{
Console.WriteLine($"Id : {order.OrderId}, Date : {order.OrderDate}");
}
Remarks
The items are first searched in cache. The items not found in cache are then retrieved from the storage.
GetListAsync(EntityViewParameters<TEntityView>, AdditionalDataExpressions, Func<IQueryable<TEntityView>, IQueryable<TEntityView>>?, CancellationToken)
Gets entity view items.
[Obsolete("Use IEntityViewRepositoryContext<TEntityView>.SetUIViewName method instead.")]
Task<IReadOnlyList<TEntityView>> GetListAsync(EntityViewParameters<TEntityView> parameters, AdditionalDataExpressions additionalDataExpressions, Func<IQueryable<TEntityView>, IQueryable<TEntityView>>? queryCustomization, CancellationToken cancellationToken)
Parameters
parametersEntityViewParameters<TEntityView>Parameters.
additionalDataExpressionsAdditionalDataExpressionsThe expressions to retrieve additional data.
queryCustomizationFunc<IQueryable<TEntityView>, IQueryable<TEntityView>>Query customization.
cancellationTokenCancellationTokenA CancellationToken that can be used to cancel the operation.
Returns
- Task<IReadOnlyList<TEntityView>>
The entity view items.
Examples
The following example shows how to get all daily orders and display them.
IReadOnlyList<IOrderView> dailyOrders = await EntityViewRepositories.OrderView.GetListAsync(e => e.Where(o => o.OrderDate < DateTime.Today));
foreach (IOrderView order in dailyOrders)
{
Console.WriteLine($"Id : {order.OrderId}, Date : {order.OrderDate}");
}
Remarks
The items are first searched in cache. The items not found in cache are then retrieved from the storage.
GetListAsync(EntityViewParameters<TEntityView>, AdditionalDataExpressions, CancellationToken)
Gets entity view items.
[Obsolete("Use IEntityViewRepositoryContext<TEntityView>.SetUIViewName method instead.")]
Task<IReadOnlyList<TEntityView>> GetListAsync(EntityViewParameters<TEntityView> parameters, AdditionalDataExpressions additionalDataExpressions, CancellationToken cancellationToken)
Parameters
parametersEntityViewParameters<TEntityView>Parameters.
additionalDataExpressionsAdditionalDataExpressionsThe expressions to retrieve additional data.
cancellationTokenCancellationTokenA CancellationToken that can be used to cancel the operation.
Returns
- Task<IReadOnlyList<TEntityView>>
The entity view items.
Examples
The following example shows how to get all daily orders and display them.
IReadOnlyList<IOrderView> dailyOrders = await EntityViewRepositories.OrderView.GetListAsync(e => e.Where(o => o.OrderDate < DateTime.Today));
foreach (IOrderView order in dailyOrders)
{
Console.WriteLine($"Id : {order.OrderId}, Date : {order.OrderDate}");
}
Remarks
The items are first searched in cache. The items not found in cache are then retrieved from the storage.
GetListAsync(EntityViewParameters<TEntityView>, Func<IQueryable<TEntityView>, IQueryable<TEntityView>>?)
Gets entity view items.
Task<IReadOnlyList<TEntityView>> GetListAsync(EntityViewParameters<TEntityView> parameters, Func<IQueryable<TEntityView>, IQueryable<TEntityView>>? queryCustomization)
Parameters
parametersEntityViewParameters<TEntityView>Parameters.
queryCustomizationFunc<IQueryable<TEntityView>, IQueryable<TEntityView>>Query customization.
Returns
- Task<IReadOnlyList<TEntityView>>
The entity view items.
Examples
The following example shows how to get all daily orders and display them.
IReadOnlyList<IOrderView> dailyOrders = await EntityViewRepositories.OrderView.GetListAsync(e => e.Where(o => o.OrderDate < DateTime.Today));
foreach (IOrderView order in dailyOrders)
{
Console.WriteLine($"Id : {order.OrderId}, Date : {order.OrderDate}");
}
Remarks
The items are first searched in cache. The items not found in cache are then retrieved from the storage.
GetListAsync(EntityViewParameters<TEntityView>, Func<IQueryable<TEntityView>, IQueryable<TEntityView>>?, CancellationToken)
Gets entity view items.
Task<IReadOnlyList<TEntityView>> GetListAsync(EntityViewParameters<TEntityView> parameters, Func<IQueryable<TEntityView>, IQueryable<TEntityView>>? queryCustomization, CancellationToken cancellationToken)
Parameters
parametersEntityViewParameters<TEntityView>Parameters.
queryCustomizationFunc<IQueryable<TEntityView>, IQueryable<TEntityView>>Query customization.
cancellationTokenCancellationTokenA CancellationToken that can be used to cancel the operation.
Returns
- Task<IReadOnlyList<TEntityView>>
The entity view items.
Examples
The following example shows how to get all daily orders and display them.
IReadOnlyList<IOrderView> dailyOrders = await EntityViewRepositories.OrderView.GetListAsync(e => e.Where(o => o.OrderDate < DateTime.Today));
foreach (IOrderView order in dailyOrders)
{
Console.WriteLine($"Id : {order.OrderId}, Date : {order.OrderDate}");
}
Remarks
The items are first searched in cache. The items not found in cache are then retrieved from the storage.
GetListAsync(EntityViewParameters<TEntityView>, CancellationToken)
Gets entity view items.
Task<IReadOnlyList<TEntityView>> GetListAsync(EntityViewParameters<TEntityView> parameters, CancellationToken cancellationToken)
Parameters
parametersEntityViewParameters<TEntityView>Parameters.
cancellationTokenCancellationTokenA CancellationToken that can be used to cancel the operation.
Returns
- Task<IReadOnlyList<TEntityView>>
The entity view items.
Examples
The following example shows how to get all daily orders and display them.
IReadOnlyList<IOrderView> dailyOrders = await EntityViewRepositories.OrderView.GetListAsync(e => e.Where(o => o.OrderDate < DateTime.Today));
foreach (IOrderView order in dailyOrders)
{
Console.WriteLine($"Id : {order.OrderId}, Date : {order.OrderDate}");
}
Remarks
The items are first searched in cache. The items not found in cache are then retrieved from the storage.
GetListAsync(AdditionalDataExpressions)
Gets entity view items.
[Obsolete("Use IEntityViewRepositoryContext<TEntityView>.SetUIViewName method instead.")]
Task<IReadOnlyList<TEntityView>> GetListAsync(AdditionalDataExpressions additionalDataExpressions)
Parameters
additionalDataExpressionsAdditionalDataExpressionsThe expressions to retrieve additional data.
Returns
- Task<IReadOnlyList<TEntityView>>
The entity view items.
Examples
The following example shows how to get all daily orders and display them.
IReadOnlyList<IOrderView> dailyOrders = await EntityViewRepositories.OrderView.GetListAsync(e => e.Where(o => o.OrderDate < DateTime.Today));
foreach (IOrderView order in dailyOrders)
{
Console.WriteLine($"Id : {order.OrderId}, Date : {order.OrderDate}");
}
GetListAsync(AdditionalDataExpressions, Func<IQueryable<TEntityView>, IQueryable<TEntityView>>?)
Gets entity view items.
[Obsolete("Use IEntityViewRepositoryContext<TEntityView>.SetUIViewName method instead.")]
Task<IReadOnlyList<TEntityView>> GetListAsync(AdditionalDataExpressions additionalDataExpressions, Func<IQueryable<TEntityView>, IQueryable<TEntityView>>? queryCustomization)
Parameters
additionalDataExpressionsAdditionalDataExpressionsThe expressions to retrieve additional data.
queryCustomizationFunc<IQueryable<TEntityView>, IQueryable<TEntityView>>Query customization.
Returns
- Task<IReadOnlyList<TEntityView>>
The entity view items.
Examples
The following example shows how to get all daily orders and display them.
IReadOnlyList<IOrderView> dailyOrders = await EntityViewRepositories.OrderView.GetListAsync(e => e.Where(o => o.OrderDate < DateTime.Today));
foreach (IOrderView order in dailyOrders)
{
Console.WriteLine($"Id : {order.OrderId}, Date : {order.OrderDate}");
}
GetListAsync(AdditionalDataExpressions, Func<IQueryable<TEntityView>, IQueryable<TEntityView>>?, CancellationToken)
Gets entity view items.
[Obsolete("Use IEntityViewRepositoryContext<TEntityView>.SetUIViewName method instead.")]
Task<IReadOnlyList<TEntityView>> GetListAsync(AdditionalDataExpressions additionalDataExpressions, Func<IQueryable<TEntityView>, IQueryable<TEntityView>>? queryCustomization, CancellationToken cancellationToken)
Parameters
additionalDataExpressionsAdditionalDataExpressionsThe expressions to retrieve additional data.
queryCustomizationFunc<IQueryable<TEntityView>, IQueryable<TEntityView>>Query customization.
cancellationTokenCancellationTokenA CancellationToken that can be used to cancel the operation.
Returns
- Task<IReadOnlyList<TEntityView>>
The entity view items.
Examples
The following example shows how to get all daily orders and display them.
IReadOnlyList<IOrderView> dailyOrders = await EntityViewRepositories.OrderView.GetListAsync(e => e.Where(o => o.OrderDate < DateTime.Today));
foreach (IOrderView order in dailyOrders)
{
Console.WriteLine($"Id : {order.OrderId}, Date : {order.OrderDate}");
}
GetListAsync(AdditionalDataExpressions, CancellationToken)
Gets entity view items.
[Obsolete("Use IEntityViewRepositoryContext<TEntityView>.SetUIViewName method instead.")]
Task<IReadOnlyList<TEntityView>> GetListAsync(AdditionalDataExpressions additionalDataExpressions, CancellationToken cancellationToken)
Parameters
additionalDataExpressionsAdditionalDataExpressionsThe expressions to retrieve additional data.
cancellationTokenCancellationTokenA CancellationToken that can be used to cancel the operation.
Returns
- Task<IReadOnlyList<TEntityView>>
The entity view items.
Examples
The following example shows how to get all daily orders and display them.
IReadOnlyList<IOrderView> dailyOrders = await EntityViewRepositories.OrderView.GetListAsync(e => e.Where(o => o.OrderDate < DateTime.Today));
foreach (IOrderView order in dailyOrders)
{
Console.WriteLine($"Id : {order.OrderId}, Date : {order.OrderDate}");
}
GetListAsync(Func<IQueryable<TEntityView>, IQueryable<TEntityView>>?)
Gets entity view items.
Task<IReadOnlyList<TEntityView>> GetListAsync(Func<IQueryable<TEntityView>, IQueryable<TEntityView>>? queryCustomization)
Parameters
queryCustomizationFunc<IQueryable<TEntityView>, IQueryable<TEntityView>>Query customization.
Returns
- Task<IReadOnlyList<TEntityView>>
The entity view items.
Examples
The following example shows how to get all daily orders and display them.
IReadOnlyList<IOrderView> dailyOrders = await EntityViewRepositories.OrderView.GetListAsync(e => e.Where(o => o.OrderDate < DateTime.Today));
foreach (IOrderView order in dailyOrders)
{
Console.WriteLine($"Id : {order.OrderId}, Date : {order.OrderDate}");
}
GetListAsync(Func<IQueryable<TEntityView>, IQueryable<TEntityView>>?, CancellationToken)
Gets entity view items.
Task<IReadOnlyList<TEntityView>> GetListAsync(Func<IQueryable<TEntityView>, IQueryable<TEntityView>>? queryCustomization, CancellationToken cancellationToken)
Parameters
queryCustomizationFunc<IQueryable<TEntityView>, IQueryable<TEntityView>>Query customization.
cancellationTokenCancellationTokenA CancellationToken that can be used to cancel the operation.
Returns
- Task<IReadOnlyList<TEntityView>>
The entity view items.
Examples
The following example shows how to get all daily orders and display them.
IReadOnlyList<IOrderView> dailyOrders = await EntityViewRepositories.OrderView.GetListAsync(e => e.Where(o => o.OrderDate < DateTime.Today));
foreach (IOrderView order in dailyOrders)
{
Console.WriteLine($"Id : {order.OrderId}, Date : {order.OrderDate}");
}
GetListAsync(CancellationToken)
Gets entity view items.
Task<IReadOnlyList<TEntityView>> GetListAsync(CancellationToken cancellationToken)
Parameters
cancellationTokenCancellationTokenA CancellationToken that can be used to cancel the operation.
Returns
- Task<IReadOnlyList<TEntityView>>
The entity view items.
GetListByKeysAsync(EntityViewParameters<TEntityView>, AdditionalDataExpressions, object[])
Gets entity view items.
[Obsolete("Use IEntityViewRepositoryContext<TEntityView>.SetUIViewName method instead.")]
Task<IReadOnlyList<TEntityView>> GetListByKeysAsync(EntityViewParameters<TEntityView> parameters, AdditionalDataExpressions additionalDataExpressions, object[] keys)
Parameters
parametersEntityViewParameters<TEntityView>Parameters.
additionalDataExpressionsAdditionalDataExpressionsThe expressions to retrieve additional data.
keysobject[]The keys of the items to retrieve.
Returns
- Task<IReadOnlyList<TEntityView>>
The entity view items.
GetListByKeysAsync(EntityViewParameters<TEntityView>, AdditionalDataExpressions, object[], CancellationToken)
Gets entity view items.
[Obsolete("Use IEntityViewRepositoryContext<TEntityView>.SetUIViewName method instead.")]
Task<IReadOnlyList<TEntityView>> GetListByKeysAsync(EntityViewParameters<TEntityView> parameters, AdditionalDataExpressions additionalDataExpressions, object[] keys, CancellationToken cancellationToken)
Parameters
parametersEntityViewParameters<TEntityView>Parameters.
additionalDataExpressionsAdditionalDataExpressionsThe expressions to retrieve additional data.
keysobject[]The keys of the items to retrieve.
cancellationTokenCancellationTokenA CancellationToken that can be used to cancel the operation.
Returns
- Task<IReadOnlyList<TEntityView>>
The entity view items.
GetListByKeysAsync(EntityViewParameters<TEntityView>, object[])
Gets entity view items.
Task<IReadOnlyList<TEntityView>> GetListByKeysAsync(EntityViewParameters<TEntityView> parameters, object[] keys)
Parameters
parametersEntityViewParameters<TEntityView>Parameters.
keysobject[]The keys of the items to retrieve.
Returns
- Task<IReadOnlyList<TEntityView>>
The entity view items.
GetListByKeysAsync(EntityViewParameters<TEntityView>, object[], CancellationToken)
Gets entity view items.
Task<IReadOnlyList<TEntityView>> GetListByKeysAsync(EntityViewParameters<TEntityView> parameters, object[] keys, CancellationToken cancellationToken)
Parameters
parametersEntityViewParameters<TEntityView>Parameters.
keysobject[]The keys of the items to retrieve.
cancellationTokenCancellationTokenA CancellationToken that can be used to cancel the operation.
Returns
- Task<IReadOnlyList<TEntityView>>
The entity view items.
GetListByKeysAsync(AdditionalDataExpressions, object[])
Gets entity view items.
[Obsolete("Use IEntityViewRepositoryContext<TEntityView>.SetUIViewName method instead.")]
Task<IReadOnlyList<TEntityView>> GetListByKeysAsync(AdditionalDataExpressions additionalDataExpressions, object[] keys)
Parameters
additionalDataExpressionsAdditionalDataExpressionsThe expressions to retrieve additional data.
keysobject[]The keys of the items to retrieve.
Returns
- Task<IReadOnlyList<TEntityView>>
The entity view items.
GetListByKeysAsync(AdditionalDataExpressions, object[], CancellationToken)
Gets entity view items.
[Obsolete("Use IEntityViewRepositoryContext<TEntityView>.SetUIViewName method instead.")]
Task<IReadOnlyList<TEntityView>> GetListByKeysAsync(AdditionalDataExpressions additionalDataExpressions, object[] keys, CancellationToken cancellationToken)
Parameters
additionalDataExpressionsAdditionalDataExpressionsThe expressions to retrieve additional data.
keysobject[]The keys of the items to retrieve.
cancellationTokenCancellationTokenA CancellationToken that can be used to cancel the operation.
Returns
- Task<IReadOnlyList<TEntityView>>
The entity view items.
GetListByKeysAsync(object[])
Gets entity view items.
Task<IReadOnlyList<TEntityView>> GetListByKeysAsync(object[] keys)
Parameters
keysobject[]The keys of the items to retrieve.
Returns
- Task<IReadOnlyList<TEntityView>>
The entity view items.
Remarks
The items are first searched in cache. The items not found in cache are then retrieved from the storage.
GetListByKeysAsync(object[], CancellationToken)
Gets entity view items.
Task<IReadOnlyList<TEntityView>> GetListByKeysAsync(object[] keys, CancellationToken cancellationToken)
Parameters
keysobject[]The keys of the items to retrieve.
cancellationTokenCancellationTokenA CancellationToken that can be used to cancel the operation.
Returns
- Task<IReadOnlyList<TEntityView>>
The entity view items.
Remarks
The items are first searched in cache. The items not found in cache are then retrieved from the storage.
GetPagedListAsync(int, int)
Gets paged entity view items.
Task<IPagedList<TEntityView>> GetPagedListAsync(int skip, int top)
Parameters
Returns
- Task<IPagedList<TEntityView>>
The entity view items.
GetPagedListAsync(int, int, EntityViewParameters<TEntityView>)
Gets paged entity view items.
Task<IPagedList<TEntityView>> GetPagedListAsync(int skip, int top, EntityViewParameters<TEntityView> parameters)
Parameters
skipintThe number of elements to skip.
topintThe number of elements to return.
parametersEntityViewParameters<TEntityView>Parameters.
Returns
- Task<IPagedList<TEntityView>>
The entity view items.
GetPagedListAsync(int, int, EntityViewParameters<TEntityView>, AdditionalDataExpressions)
Gets paged entity view items.
[Obsolete("Use IEntityViewRepositoryContext<TEntityView>.SetUIViewName method instead.")]
Task<IPagedList<TEntityView>> GetPagedListAsync(int skip, int top, EntityViewParameters<TEntityView> parameters, AdditionalDataExpressions additionalDataExpressions)
Parameters
skipintThe number of elements to skip.
topintThe number of elements to return.
parametersEntityViewParameters<TEntityView>Parameters.
additionalDataExpressionsAdditionalDataExpressionsThe expressions to retrieve additional data.
Returns
- Task<IPagedList<TEntityView>>
The entity view items.
GetPagedListAsync(int, int, EntityViewParameters<TEntityView>, AdditionalDataExpressions, Func<IQueryable<TEntityView>, IQueryable<TEntityView>>?)
Gets paged entity view items.
[Obsolete("Use IEntityViewRepositoryContext<TEntityView>.SetUIViewName method instead.")]
Task<IPagedList<TEntityView>> GetPagedListAsync(int skip, int top, EntityViewParameters<TEntityView> parameters, AdditionalDataExpressions additionalDataExpressions, Func<IQueryable<TEntityView>, IQueryable<TEntityView>>? queryCustomization)
Parameters
skipintThe number of elements to skip.
topintThe number of elements to return.
parametersEntityViewParameters<TEntityView>Parameters.
additionalDataExpressionsAdditionalDataExpressionsThe expressions to retrieve additional data.
queryCustomizationFunc<IQueryable<TEntityView>, IQueryable<TEntityView>>Query customization.
Returns
- Task<IPagedList<TEntityView>>
The entity view items.
GetPagedListAsync(int, int, EntityViewParameters<TEntityView>, AdditionalDataExpressions, Func<IQueryable<TEntityView>, IQueryable<TEntityView>>?, CancellationToken)
Gets paged entity view items.
[Obsolete("Use IEntityViewRepositoryContext<TEntityView>.SetUIViewName method instead.")]
Task<IPagedList<TEntityView>> GetPagedListAsync(int skip, int top, EntityViewParameters<TEntityView> parameters, AdditionalDataExpressions additionalDataExpressions, Func<IQueryable<TEntityView>, IQueryable<TEntityView>>? queryCustomization, CancellationToken cancellationToken)
Parameters
skipintThe number of elements to skip.
topintThe number of elements to return.
parametersEntityViewParameters<TEntityView>Parameters.
additionalDataExpressionsAdditionalDataExpressionsThe expressions to retrieve additional data.
queryCustomizationFunc<IQueryable<TEntityView>, IQueryable<TEntityView>>Query customization.
cancellationTokenCancellationTokenA CancellationToken that can be used to cancel the operation.
Returns
- Task<IPagedList<TEntityView>>
The entity view items.
GetPagedListAsync(int, int, EntityViewParameters<TEntityView>, AdditionalDataExpressions, CancellationToken)
Gets paged entity view items.
[Obsolete("Use IEntityViewRepositoryContext<TEntityView>.SetUIViewName method instead.")]
Task<IPagedList<TEntityView>> GetPagedListAsync(int skip, int top, EntityViewParameters<TEntityView> parameters, AdditionalDataExpressions additionalDataExpressions, CancellationToken cancellationToken)
Parameters
skipintThe number of elements to skip.
topintThe number of elements to return.
parametersEntityViewParameters<TEntityView>Parameters.
additionalDataExpressionsAdditionalDataExpressionsThe expressions to retrieve additional data.
cancellationTokenCancellationTokenA CancellationToken that can be used to cancel the operation.
Returns
- Task<IPagedList<TEntityView>>
The entity view items.
GetPagedListAsync(int, int, EntityViewParameters<TEntityView>, Func<IQueryable<TEntityView>, IQueryable<TEntityView>>?)
Gets paged entity view items.
Task<IPagedList<TEntityView>> GetPagedListAsync(int skip, int top, EntityViewParameters<TEntityView> parameters, Func<IQueryable<TEntityView>, IQueryable<TEntityView>>? queryCustomization)
Parameters
skipintThe number of elements to skip.
topintThe number of elements to return.
parametersEntityViewParameters<TEntityView>Parameters.
queryCustomizationFunc<IQueryable<TEntityView>, IQueryable<TEntityView>>Query customization.
Returns
- Task<IPagedList<TEntityView>>
The entity view items.
GetPagedListAsync(int, int, EntityViewParameters<TEntityView>, Func<IQueryable<TEntityView>, IQueryable<TEntityView>>?, CancellationToken)
Gets paged entity view items.
Task<IPagedList<TEntityView>> GetPagedListAsync(int skip, int top, EntityViewParameters<TEntityView> parameters, Func<IQueryable<TEntityView>, IQueryable<TEntityView>>? queryCustomization, CancellationToken cancellationToken)
Parameters
skipintThe number of elements to skip.
topintThe number of elements to return.
parametersEntityViewParameters<TEntityView>Parameters.
queryCustomizationFunc<IQueryable<TEntityView>, IQueryable<TEntityView>>Query customization.
cancellationTokenCancellationTokenA CancellationToken that can be used to cancel the operation.
Returns
- Task<IPagedList<TEntityView>>
The entity view items.
GetPagedListAsync(int, int, EntityViewParameters<TEntityView>, CancellationToken)
Gets paged entity view items.
Task<IPagedList<TEntityView>> GetPagedListAsync(int skip, int top, EntityViewParameters<TEntityView> parameters, CancellationToken cancellationToken)
Parameters
skipintThe number of elements to skip.
topintThe number of elements to return.
parametersEntityViewParameters<TEntityView>Parameters.
cancellationTokenCancellationTokenA CancellationToken that can be used to cancel the operation.
Returns
- Task<IPagedList<TEntityView>>
The entity view items.
GetPagedListAsync(int, int, AdditionalDataExpressions)
Gets paged entity view items.
[Obsolete("Use IEntityViewRepositoryContext<TEntityView>.SetUIViewName method instead.")]
Task<IPagedList<TEntityView>> GetPagedListAsync(int skip, int top, AdditionalDataExpressions additionalDataExpressions)
Parameters
skipintThe number of elements to skip.
topintThe number of elements to return.
additionalDataExpressionsAdditionalDataExpressionsThe expressions to retrieve additional data.
Returns
- Task<IPagedList<TEntityView>>
The entity view items.
GetPagedListAsync(int, int, AdditionalDataExpressions, Func<IQueryable<TEntityView>, IQueryable<TEntityView>>?)
Gets paged entity view items.
[Obsolete("Use IEntityViewRepositoryContext<TEntityView>.SetUIViewName method instead.")]
Task<IPagedList<TEntityView>> GetPagedListAsync(int skip, int top, AdditionalDataExpressions additionalDataExpressions, Func<IQueryable<TEntityView>, IQueryable<TEntityView>>? queryCustomization)
Parameters
skipintThe number of elements to skip.
topintThe number of elements to return.
additionalDataExpressionsAdditionalDataExpressionsThe expressions to retrieve additional data.
queryCustomizationFunc<IQueryable<TEntityView>, IQueryable<TEntityView>>Query customization.
Returns
- Task<IPagedList<TEntityView>>
The entity view items.
GetPagedListAsync(int, int, AdditionalDataExpressions, Func<IQueryable<TEntityView>, IQueryable<TEntityView>>?, CancellationToken)
Gets paged entity view items.
[Obsolete("Use IEntityViewRepositoryContext<TEntityView>.SetUIViewName method instead.")]
Task<IPagedList<TEntityView>> GetPagedListAsync(int skip, int top, AdditionalDataExpressions additionalDataExpressions, Func<IQueryable<TEntityView>, IQueryable<TEntityView>>? queryCustomization, CancellationToken cancellationToken)
Parameters
skipintThe number of elements to skip.
topintThe number of elements to return.
additionalDataExpressionsAdditionalDataExpressionsThe expressions to retrieve additional data.
queryCustomizationFunc<IQueryable<TEntityView>, IQueryable<TEntityView>>Query customization.
cancellationTokenCancellationTokenA CancellationToken that can be used to cancel the operation.
Returns
- Task<IPagedList<TEntityView>>
The entity view items.
GetPagedListAsync(int, int, AdditionalDataExpressions, CancellationToken)
Gets paged entity view items.
[Obsolete("Use IEntityViewRepositoryContext<TEntityView>.SetUIViewName method instead.")]
Task<IPagedList<TEntityView>> GetPagedListAsync(int skip, int top, AdditionalDataExpressions additionalDataExpressions, CancellationToken cancellationToken)
Parameters
skipintThe number of elements to skip.
topintThe number of elements to return.
additionalDataExpressionsAdditionalDataExpressionsThe expressions to retrieve additional data.
cancellationTokenCancellationTokenA CancellationToken that can be used to cancel the operation.
Returns
- Task<IPagedList<TEntityView>>
The entity view items.
GetPagedListAsync(int, int, Func<IQueryable<TEntityView>, IQueryable<TEntityView>>?)
Gets paged entity view items.
Task<IPagedList<TEntityView>> GetPagedListAsync(int skip, int top, Func<IQueryable<TEntityView>, IQueryable<TEntityView>>? queryCustomization)
Parameters
skipintThe number of elements to skip.
topintThe number of elements to return.
queryCustomizationFunc<IQueryable<TEntityView>, IQueryable<TEntityView>>Query customization.
Returns
- Task<IPagedList<TEntityView>>
The entity view items.
GetPagedListAsync(int, int, Func<IQueryable<TEntityView>, IQueryable<TEntityView>>?, CancellationToken)
Gets paged entity view items.
Task<IPagedList<TEntityView>> GetPagedListAsync(int skip, int top, Func<IQueryable<TEntityView>, IQueryable<TEntityView>>? queryCustomization, CancellationToken cancellationToken)
Parameters
skipintThe number of elements to skip.
topintThe number of elements to return.
queryCustomizationFunc<IQueryable<TEntityView>, IQueryable<TEntityView>>Query customization.
cancellationTokenCancellationTokenA CancellationToken that can be used to cancel the operation.
Returns
- Task<IPagedList<TEntityView>>
The entity view items.
GetPagedListAsync(int, int, CancellationToken)
Gets paged entity view items.
Task<IPagedList<TEntityView>> GetPagedListAsync(int skip, int top, CancellationToken cancellationToken)
Parameters
skipintThe number of elements to skip.
topintThe number of elements to return.
cancellationTokenCancellationTokenA CancellationToken that can be used to cancel the operation.
Returns
- Task<IPagedList<TEntityView>>
The entity view items.
GetTransformedListAsync(Func<IQueryable<TEntityView>, IQueryable<object>>)
Executes a custom LINQ projection on the entity view query and returns the transformed items.
Task<IReadOnlyList<object>> GetTransformedListAsync(Func<IQueryable<TEntityView>, IQueryable<object>> queryTransformation)
Parameters
queryTransformationFunc<IQueryable<TEntityView>, IQueryable<object>>A function that projects the entity view IQueryable<T> into an IQueryable<T> of object. Typically evaluated server-side.
Returns
- Task<IReadOnlyList<object>>
A read-only list of transformed items.
Remarks
Use this method when you need to return data that does not map directly to the entity view shape,
such as aggregations, groupings, or simple projections.
The queryTransformation delegate is typically translated into a single server-side query
(e.g. SQL) with no intermediate materialisation. Depending on retrieving rule behavior, data may
already be materialized before the transformation is applied.
Unlike GetListAsync(), this method returns a list of object values
because the resulting shape is determined entirely by the queryTransformation delegate.
Example – count orders per customer:
IReadOnlyList<object> results = await _orderViewRepository.GetTransformedListAsync(
q => q.GroupBy(o => o.CustomerId)
.Select(g => new { CustomerId = g.Key, OrderCount = g.Count() }));
foreach (dynamic row in results)
{
Console.WriteLine($"Customer {row.CustomerId}: {row.OrderCount} orders");
}
Example – total revenue per product category:
IReadOnlyList<object> revenues = await _orderLineViewRepository.GetTransformedListAsync(
q => q.GroupBy(l => l.CategoryName)
.Select(g => new { Category = g.Key, TotalRevenue = g.Sum(l => l.UnitPrice * l.Quantity) }));
GetTransformedListAsync(Func<IQueryable<TEntityView>, IQueryable<object>>, Func<IQueryable<TEntityView>, IQueryable<TEntityView>>?)
Executes a custom LINQ projection on the entity view query, optionally pre-filtering the rows before the transformation is applied, and returns the transformed items.
Task<IReadOnlyList<object>> GetTransformedListAsync(Func<IQueryable<TEntityView>, IQueryable<object>> queryTransformation, Func<IQueryable<TEntityView>, IQueryable<TEntityView>>? queryCustomizationBeforeTransformation)
Parameters
queryTransformationFunc<IQueryable<TEntityView>, IQueryable<object>>A function that projects the (pre-filtered) IQueryable<T> into an IQueryable<T> of object.
queryCustomizationBeforeTransformationFunc<IQueryable<TEntityView>, IQueryable<TEntityView>>An optional function applied to the base query before
queryTransformation. Pass null to skip pre-filtering.
Returns
- Task<IReadOnlyList<object>>
A read-only list of transformed items.
Remarks
queryCustomizationBeforeTransformation is applied first — use it to restrict
the dataset (e.g. a Where clause) before the potentially heavier
queryTransformation (e.g. a GroupBy) is evaluated.
In the nominal case, both delegates are combined into a single server-side query.
Depending on retrieving rule behavior, data may already be materialized before the transformation.
Example – revenue per category for a specific year:
int year = 2025;
IReadOnlyList<object> revenues = await _orderLineViewRepository.GetTransformedListAsync(
queryTransformation: q =>
q.GroupBy(l => l.CategoryName)
.Select(g => new { Category = g.Key, TotalRevenue = g.Sum(l => l.UnitPrice * l.Quantity) }),
queryCustomizationBeforeTransformation: q =>
q.Where(l => l.OrderYear == year));
Example – active employee headcount per department:
IReadOnlyList<object> headcount = await _employeeViewRepository.GetTransformedListAsync(
queryTransformation: q =>
q.GroupBy(e => e.DepartmentName)
.Select(g => new { Department = g.Key, Count = g.Count() })
.OrderByDescending(r => r.Count),
queryCustomizationBeforeTransformation: q =>
q.Where(e => e.IsActive));
GetTransformedListAsync(Func<IQueryable<TEntityView>, IQueryable<object>>, Func<IQueryable<TEntityView>, IQueryable<TEntityView>>?, CancellationToken)
Executes a custom LINQ projection on the entity view query, optionally pre-filtering the rows
before the transformation is applied, and returns the transformed items.
This is the primary overload; all other GetTransformedListAsync variants delegate to it.
Task<IReadOnlyList<object>> GetTransformedListAsync(Func<IQueryable<TEntityView>, IQueryable<object>> queryTransformation, Func<IQueryable<TEntityView>, IQueryable<TEntityView>>? queryCustomizationBeforeTransformation, CancellationToken cancellationToken)
Parameters
queryTransformationFunc<IQueryable<TEntityView>, IQueryable<object>>A function that projects the (pre-filtered) IQueryable<T> into an IQueryable<T> of object.
queryCustomizationBeforeTransformationFunc<IQueryable<TEntityView>, IQueryable<TEntityView>>An optional function applied to the query before
queryTransformation. Pass null to skip.cancellationTokenCancellationTokenA CancellationToken that can be used to cancel the operation.
Returns
- Task<IReadOnlyList<object>>
A read-only list of transformed items.
Remarks
The execution pipeline is:
-
Optionally apply
queryCustomizationBeforeTransformationto filter or reshape source rows (e.g.Where,OrderBy). -
Apply
queryTransformationto project into the desired shape (e.g.GroupBy+Select,Distinct). - Execute a typically single server-side query and materialise the list. Depending on retrieving rule behavior, data may already be materialized before this step.
Example – invoice summary per salesperson for Q1:
IReadOnlyList<object> summaries = await _invoiceViewRepository.GetTransformedListAsync(
queryTransformation: q =>
q.GroupBy(i => i.SalespersonName)
.Select(g => new
{
Salesperson = g.Key,
InvoiceCount = g.Count(),
TotalAmount = g.Sum(i => i.TotalAmount),
}),
queryCustomizationBeforeTransformation: q =>
q.Where(i => i.InvoiceDate.Year == 2025 && i.InvoiceDate.Month <= 3),
cancellationToken: cancellationToken);
Example – top 5 products by quantity sold:
IReadOnlyList<object> top5 = await _orderLineViewRepository.GetTransformedListAsync(
queryTransformation: q =>
q.GroupBy(l => l.ProductName)
.Select(g => new { Product = g.Key, TotalQty = g.Sum(l => l.Quantity) })
.OrderByDescending(r => r.TotalQty)
.Take(5),
queryCustomizationBeforeTransformation: null,
cancellationToken: cancellationToken);
GetTransformedListAsync(Func<IQueryable<TEntityView>, IQueryable<object>>, CancellationToken)
Executes a custom LINQ projection on the entity view query and returns the transformed items, with support for cooperative cancellation.
Task<IReadOnlyList<object>> GetTransformedListAsync(Func<IQueryable<TEntityView>, IQueryable<object>> queryTransformation, CancellationToken cancellationToken)
Parameters
queryTransformationFunc<IQueryable<TEntityView>, IQueryable<object>>A function that projects the entity view IQueryable<T> into an IQueryable<T> of object.
cancellationTokenCancellationTokenA CancellationToken that can be used to cancel the operation.
Returns
- Task<IReadOnlyList<object>>
A read-only list of transformed items.
Remarks
Identical to GetTransformedListAsync(Func<IQueryable<TEntityView>, IQueryable<object>>) but accepts a CancellationToken so the caller can abort a long-running query.
Example – list distinct billing countries:
IReadOnlyList<object> countries = await _customerViewRepository.GetTransformedListAsync(
q => q.Select(c => c.BillingCountry).Distinct().OrderBy(c => c),
cancellationToken);
New()
Creates an entity view instance without adding it to the repository.
TEntityView New()
Returns
- TEntityView
The created entity view instance.