Table of Contents

Interface IService<TKey1, TKey2, TModel, TFilter>

Namespace
Magicalizer.Domain.Services.Abstractions
Assembly
Magicalizer.Domain.Services.Abstractions.dll

Service of models with a composite primary key of two properties.

public interface IService<TKey1, TKey2, TModel, TFilter> : IService<TModel, TFilter> where TModel : class, IModel where TFilter : class, IFilter

Type Parameters

TKey1

Type of the first primary key property.

TKey2

Type of the second primary key property.

TModel

Model type.

TFilter

Filter type.

Inherited Members

Methods

DeleteAsync(TKey1, TKey2, CancellationToken)

Deletes the model by the composite primary key.

Task DeleteAsync(TKey1 id1, TKey2 id2, CancellationToken cancellationToken = default)

Parameters

id1 TKey1

Value of the first primary key property.

id2 TKey2

Value of the second primary key property.

cancellationToken CancellationToken

Token to cancel the operation.

Returns

Task

Exceptions

ModelNotFoundException

The model doesn't exist (or isn't available through the query prefilters).

ModelInUseException

The database restricts the deletion of the model (e.g. other models reference it).

GetByIdAsync(TKey1, TKey2, IEnumerable<IInclusion<TModel>>?, CancellationToken)

Gets the model by the composite primary key.

Task<TModel?> GetByIdAsync(TKey1 id1, TKey2 id2, IEnumerable<IInclusion<TModel>>? inclusions = null, CancellationToken cancellationToken = default)

Parameters

id1 TKey1

Value of the first primary key property.

id2 TKey2

Value of the second primary key property.

inclusions IEnumerable<IInclusion<TModel>>

Inclusions to apply (property paths of related models).

cancellationToken CancellationToken

Token to cancel the operation.

Returns

Task<TModel>

Model, or null if it doesn't exist.