Interface IEntityViewRepository
- Namespace
- GroupeIsa.Neos.Application.Persistence
- Assembly
- GroupeIsa.Neos.Application.Abstractions.dll
Provides the functionalities of an entity view persistence.
public interface IEntityViewRepository
Properties
EntityName
Gets the entity name.
string? EntityName { get; }
Property Value
EntityViewName
Gets the entity view name.
string EntityViewName { get; }
Property Value
EntityViewType
Gets the entity view type.
Type EntityViewType { get; }
Property Value
KeyPropertyNames
Gets the names of the properties of the key.
IReadOnlyList<string> KeyPropertyNames { get; }
Property Value
Methods
AddFromExternalSourceAsync(IEntityView, CancellationToken)
Adds an item from an external source.
Task<IEntityView> AddFromExternalSourceAsync(IEntityView entityView, CancellationToken cancellationToken = default)
Parameters
entityViewIEntityViewThe entity view item.
cancellationTokenCancellationTokenA CancellationToken that can be used to cancel the operation.
Returns
- Task<IEntityView>
The added entity view item.
AddFromJsonAsync(string, CancellationToken)
Adds an item from a JSON definition.
Task<IEntityView> AddFromJsonAsync(string jsonContent, CancellationToken cancellationToken = default)
Parameters
jsonContentstringThe entity view definition in JSON format.
cancellationTokenCancellationTokenA CancellationToken that can be used to cancel the operation.
Returns
- Task<IEntityView>
The added entity view item.
CountAsync(Func<IQueryable, IQueryable>, CancellationToken)
Count the number of elements matching the query.
Task<long> CountAsync(Func<IQueryable, IQueryable> queryCustomization, CancellationToken cancellationToken = default)
Parameters
queryCustomizationFunc<IQueryable, IQueryable>The query customization.
cancellationTokenCancellationTokenA CancellationToken that can be used to cancel the operation.
Returns
CreateKey(params object[])
Creates a key from key values.
object CreateKey(params object[] keyValues)
Parameters
keyValuesobject[]The key values (in the key order).
Returns
- object
The key.
GetFileAsync(object, string, CancellationToken)
Gets a file.
Task<IFileResult> GetFileAsync(object key, string propertyName, CancellationToken cancellationToken = default)
Parameters
keyobjectThe key.
propertyNamestringThe file property name.
cancellationTokenCancellationTokenA CancellationToken that can be used to cancel the operation.
Returns
- Task<IFileResult>
The file.
GetKeyValues(object)
Gets key values from a key.
object[] GetKeyValues(object key)
Parameters
keyobjectThe key.
Returns
- object[]
The key values (in the key order).
GetListAsync(Func<IQueryable, IQueryable>, CancellationToken)
Gets entity view items.
Task<IReadOnlyList<IEntityView>> GetListAsync(Func<IQueryable, IQueryable> queryCustomization, CancellationToken cancellationToken = default)
Parameters
queryCustomizationFunc<IQueryable, IQueryable>The query customization.
cancellationTokenCancellationTokenA CancellationToken that can be used to cancel the operation.
Returns
- Task<IReadOnlyList<IEntityView>>
The entity view items.
GetTransformedListAsync(Func<IQueryable, IQueryable>, Func<IQueryable, IQueryable>, CancellationToken)
Executes a custom LINQ projection on the entity view query using non-generic IQueryable delegates and returns the transformed items.
Task<IReadOnlyList<object>> GetTransformedListAsync(Func<IQueryable, IQueryable> queryTransformation, Func<IQueryable, IQueryable> queryCustomizationBeforeTransformation, CancellationToken cancellationToken = default)
Parameters
queryTransformationFunc<IQueryable, IQueryable>A non-generic function that transforms the base IQueryable into a projected IQueryable of object. Evaluated server-side.
queryCustomizationBeforeTransformationFunc<IQueryable, IQueryable>A non-generic function applied to the base query before
queryTransformation. Use it to pre-filter or pre-sort rows.cancellationTokenCancellationTokenA CancellationToken that can be used to cancel the operation.
Returns
- Task<IReadOnlyList<object>>
A read-only list of transformed items.
Remarks
This non-generic overload is intended for infrastructure or generic framework code where the concrete entity view type is not known at compile time. In business code, prefer the strongly-typed overloads on IEntityViewRepository<TEntityView>.
queryCustomizationBeforeTransformation is applied first (e.g. filter rows),
then queryTransformation projects the result into a new shape.
Both delegates are combined into a single server-side query.
Example – dynamic aggregation via non-generic interface:
// _repository is IEntityViewRepository (non-generic)
IReadOnlyList<object> results = await _repository.GetTransformedListAsync(
queryTransformation: q => ((IQueryable<IOrderView>)q)
.GroupBy(o => o.Status)
.Select(g => new { Status = g.Key, Count = g.Count() }),
queryCustomizationBeforeTransformation: q => q,
cancellationToken: cancellationToken);
UpdateFromJsonAsync(object, string, CancellationToken)
Finds an item by key and updates it from a JSON definition.
Task<IEntityView> UpdateFromJsonAsync(object key, string jsonContent, CancellationToken cancellationToken = default)
Parameters
keyobjectThe item key.
jsonContentstringThe updated item content in JSON format.
cancellationTokenCancellationTokenA CancellationToken that can be used to cancel the operation.
Returns
- Task<IEntityView>
The updated entity view item if found; otherwise throws an exception.
UpdateFromJsonAsync(string, IEntityView, CancellationToken)
Updates an item from a JSON definition.
Task<IEntityView> UpdateFromJsonAsync(string jsonContent, IEntityView destination, CancellationToken cancellationToken = default)
Parameters
jsonContentstringThe updated item content in JSON format.
destinationIEntityViewThe item to update.
cancellationTokenCancellationTokenA CancellationToken that can be used to cancel the operation.
Returns
- Task<IEntityView>
The updated entity view item.
UpdateFromJsonAsync(string, CancellationToken)
Finds an item by the key contained in the JSON content and updates it from the JSON definition.
Task<IEntityView> UpdateFromJsonAsync(string jsonContent, CancellationToken cancellationToken = default)
Parameters
jsonContentstringThe updated item content in JSON format containing the key.
cancellationTokenCancellationTokenA CancellationToken that can be used to cancel the operation.
Returns
- Task<IEntityView>
The updated entity view item if found; otherwise throws an exception.
UpsertFromJsonAsync(string, CancellationToken)
Updates an existing item or creates a new one if it doesn't exist, based on the key contained in the JSON content.
Task<IEntityView> UpsertFromJsonAsync(string jsonContent, CancellationToken cancellationToken = default)
Parameters
jsonContentstringThe item content in JSON format containing the key.
cancellationTokenCancellationTokenA CancellationToken that can be used to cancel the operation.
Returns
- Task<IEntityView>
The upserted entity view item.