Table of Contents

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

string

EntityViewName

Gets the entity view name.

string EntityViewName { get; }

Property Value

string

EntityViewType

Gets the entity view type.

Type EntityViewType { get; }

Property Value

Type

KeyPropertyNames

Gets the names of the properties of the key.

IReadOnlyList<string> KeyPropertyNames { get; }

Property Value

IReadOnlyList<string>

Methods

AddFromExternalSourceAsync(IEntityView, CancellationToken)

Adds an item from an external source.

Task<IEntityView> AddFromExternalSourceAsync(IEntityView entityView, CancellationToken cancellationToken = default)

Parameters

entityView IEntityView

The entity view item.

cancellationToken CancellationToken

A 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

jsonContent string

The entity view definition in JSON format.

cancellationToken CancellationToken

A 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

queryCustomization Func<IQueryable, IQueryable>

The query customization.

cancellationToken CancellationToken

A CancellationToken that can be used to cancel the operation.

Returns

Task<long>

The number of elements.

CreateKey(params object[])

Creates a key from key values.

object CreateKey(params object[] keyValues)

Parameters

keyValues object[]

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

key object

The key.

propertyName string

The file property name.

cancellationToken CancellationToken

A 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

key object

The 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

queryCustomization Func<IQueryable, IQueryable>

The query customization.

cancellationToken CancellationToken

A 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

queryTransformation Func<IQueryable, IQueryable>

A non-generic function that transforms the base IQueryable into a projected IQueryable of object. Evaluated server-side.

queryCustomizationBeforeTransformation Func<IQueryable, IQueryable>

A non-generic function applied to the base query before queryTransformation. Use it to pre-filter or pre-sort rows.

cancellationToken CancellationToken

A 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

key object

The item key.

jsonContent string

The updated item content in JSON format.

cancellationToken CancellationToken

A 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

jsonContent string

The updated item content in JSON format.

destination IEntityView

The item to update.

cancellationToken CancellationToken

A 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

jsonContent string

The updated item content in JSON format containing the key.

cancellationToken CancellationToken

A 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

jsonContent string

The item content in JSON format containing the key.

cancellationToken CancellationToken

A CancellationToken that can be used to cancel the operation.

Returns

Task<IEntityView>

The upserted entity view item.