Table of Contents

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

TEntityView

The entity view type.

Inherited Members

Properties

SearchExpression

Gets or sets search expression.

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

entityView TEntityView

The entity view item.

AddNew()

Adds a new item.

TEntityView AddNew()

Returns

TEntityView

The entity view item.

Delete(TEntityView)

Deletes an item.

void Delete(TEntityView entityView)

Parameters

entityView TEntityView

The item.

DeleteAsync(object)

Deletes an item.

Task<Result> DeleteAsync(object key)

Parameters

key object

The item key.

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

key object

The 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

key object

The key.

parameters EntityViewParameters<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.

Task<TEntityView?> FindAsync(object key, EntityViewParameters<TEntityView> parameters, AdditionalDataExpressions additionalDataExpressions)

Parameters

key object

The key.

parameters EntityViewParameters<TEntityView>

Parameters.

additionalDataExpressions AdditionalDataExpressions

The expressions to retrieve additional data.

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.

Task<TEntityView?> FindAsync(object key, AdditionalDataExpressions additionalDataExpressions)

Parameters

key object

The key.

additionalDataExpressions AdditionalDataExpressions

The expressions to retrieve additional data.

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

key object

The 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

key object

The key.

parameters EntityViewParameters<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.

Task<TEntityView> GetAsync(object key, EntityViewParameters<TEntityView> parameters, AdditionalDataExpressions additionalDataExpressions)

Parameters

key object

The key.

parameters EntityViewParameters<TEntityView>

Parameters.

additionalDataExpressions AdditionalDataExpressions

The 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)

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, AdditionalDataExpressions additionalDataExpressions)

Parameters

key object

The key.

additionalDataExpressions AdditionalDataExpressions

The 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.

GetKey(TEntityView)

Gets the key from an entity view.

object GetKey(TEntityView entityView)

Parameters

entityView TEntityView

Entity view.

Returns

object

The key.

GetListAsync(EntityViewParameters<TEntityView>, AdditionalDataExpressions, Func<IQueryable<TEntityView>, IQueryable<TEntityView>>?)

Gets entity view items.

Task<IReadOnlyList<TEntityView>> GetListAsync(EntityViewParameters<TEntityView> parameters, AdditionalDataExpressions additionalDataExpressions, Func<IQueryable<TEntityView>, IQueryable<TEntityView>>? queryCustomization = null)

Parameters

parameters EntityViewParameters<TEntityView>

Parameters.

additionalDataExpressions AdditionalDataExpressions

The expressions to retrieve additional data.

queryCustomization Func<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>>?)

Gets entity view items.

Task<IReadOnlyList<TEntityView>> GetListAsync(EntityViewParameters<TEntityView> parameters, Func<IQueryable<TEntityView>, IQueryable<TEntityView>>? queryCustomization = null)

Parameters

parameters EntityViewParameters<TEntityView>

Parameters.

queryCustomization Func<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(AdditionalDataExpressions, Func<IQueryable<TEntityView>, IQueryable<TEntityView>>?)

Gets entity view items.

Task<IReadOnlyList<TEntityView>> GetListAsync(AdditionalDataExpressions additionalDataExpressions, Func<IQueryable<TEntityView>, IQueryable<TEntityView>>? queryCustomization = null)

Parameters

additionalDataExpressions AdditionalDataExpressions

The expressions to retrieve additional data.

queryCustomization Func<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>>?)

Gets entity view items.

Task<IReadOnlyList<TEntityView>> GetListAsync(Func<IQueryable<TEntityView>, IQueryable<TEntityView>>? queryCustomization = null)

Parameters

queryCustomization Func<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}");
}

GetListByKeysAsync(EntityViewParameters<TEntityView>, AdditionalDataExpressions, object[])

Gets entity view items.

Task<IReadOnlyList<TEntityView>> GetListByKeysAsync(EntityViewParameters<TEntityView> parameters, AdditionalDataExpressions additionalDataExpressions, object[] keys)

Parameters

parameters EntityViewParameters<TEntityView>

Parameters.

additionalDataExpressions AdditionalDataExpressions

The expressions to retrieve additional data.

keys object[]

The keys of the items to retrieve.

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

parameters EntityViewParameters<TEntityView>

Parameters.

keys object[]

The keys of the items to retrieve.

Returns

Task<IReadOnlyList<TEntityView>>

The entity view items.

GetListByKeysAsync(AdditionalDataExpressions, object[])

Gets entity view items.

Task<IReadOnlyList<TEntityView>> GetListByKeysAsync(AdditionalDataExpressions additionalDataExpressions, object[] keys)

Parameters

additionalDataExpressions AdditionalDataExpressions

The expressions to retrieve additional data.

keys object[]

The keys of the items to retrieve.

Returns

Task<IReadOnlyList<TEntityView>>

The entity view items.

GetListByKeysAsync(object[])

Gets entity view items.

Task<IReadOnlyList<TEntityView>> GetListByKeysAsync(object[] keys)

Parameters

keys object[]

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.

GetPagedListAsync(int, int, EntityViewParameters<TEntityView>, AdditionalDataExpressions, Func<IQueryable<TEntityView>, IQueryable<TEntityView>>?)

Gets paged entity view items.

Task<IPagedList<TEntityView>> GetPagedListAsync(int skip, int top, EntityViewParameters<TEntityView> parameters, AdditionalDataExpressions additionalDataExpressions, Func<IQueryable<TEntityView>, IQueryable<TEntityView>>? queryCustomization = null)

Parameters

skip int

The number of elements to skip.

top int

The number of elements to return.

parameters EntityViewParameters<TEntityView>

Parameters.

additionalDataExpressions AdditionalDataExpressions

The expressions to retrieve additional data.

queryCustomization Func<IQueryable<TEntityView>, IQueryable<TEntityView>>

Query customization.

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 = null)

Parameters

skip int

The number of elements to skip.

top int

The number of elements to return.

parameters EntityViewParameters<TEntityView>

Parameters.

queryCustomization Func<IQueryable<TEntityView>, IQueryable<TEntityView>>

Query customization.

Returns

Task<IPagedList<TEntityView>>

The entity view items.

GetPagedListAsync(int, int, AdditionalDataExpressions, Func<IQueryable<TEntityView>, IQueryable<TEntityView>>?)

Gets paged entity view items.

Task<IPagedList<TEntityView>> GetPagedListAsync(int skip, int top, AdditionalDataExpressions additionalDataExpressions, Func<IQueryable<TEntityView>, IQueryable<TEntityView>>? queryCustomization = null)

Parameters

skip int

The number of elements to skip.

top int

The number of elements to return.

additionalDataExpressions AdditionalDataExpressions

The expressions to retrieve additional data.

queryCustomization Func<IQueryable<TEntityView>, IQueryable<TEntityView>>

Query customization.

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 = null)

Parameters

skip int

The number of elements to skip.

top int

The number of elements to return.

queryCustomization Func<IQueryable<TEntityView>, IQueryable<TEntityView>>

Query customization.

Returns

Task<IPagedList<TEntityView>>

The entity view items.

GetTransformedListAsync(Func<IQueryable<TEntityView>, IQueryable<object>>, Func<IQueryable<TEntityView>, IQueryable<TEntityView>>?)

Gets transformed items.

Task<IReadOnlyList<object>> GetTransformedListAsync(Func<IQueryable<TEntityView>, IQueryable<object>> queryTransformation, Func<IQueryable<TEntityView>, IQueryable<TEntityView>>? queryCustomizationBeforeTransformation = null)

Parameters

queryTransformation Func<IQueryable<TEntityView>, IQueryable<object>>

The query transformation.

queryCustomizationBeforeTransformation Func<IQueryable<TEntityView>, IQueryable<TEntityView>>

The query customization before the transformation.

Returns

Task<IReadOnlyList<object>>

The transformed items.

New()

Creates an entity view instance without adding it to the repository.

TEntityView New()

Returns

TEntityView

The created entity view instance.