Table of Contents

Class EfCoreDataStore<T>

Namespace
Savvyio.Extensions.EFCore
Assembly
Savvyio.Extensions.EFCore.dll

Provides a default implementation of the IPersistentDataStore<T, TOptions> interface to serve as an abstraction layer before the actual I/O communication with a source of data using Microsoft Entity Framework Core.

public class EfCoreDataStore<T> : IPersistentDataStore<T, EfCoreQueryOptions<T>>, IWritableDataStore<T>, IReadableDataStore<T>, ISearchableDataStore<T, EfCoreQueryOptions<T>>, IDeletableDataStore<T>, IDataStore<T> where T : class

Type Parameters

T

The type of the DTO.

Inheritance
EfCoreDataStore<T>
Implements
Derived

Constructors

EfCoreDataStore(IEfCoreDataSource)

Initializes a new instance of the EfCoreDataStore<T> class.

public EfCoreDataStore(IEfCoreDataSource source)

Parameters

source IEfCoreDataSource

The IEfCoreDataSource that handles actual I/O communication with a source of data.

Properties

Set

Gets a DbSet<TEntity> that can be used to query and save instances of T.

protected DbSet<T> Set { get; }

Property Value

DbSet<T>

The DbSet<TEntity> that can be used to query and save instances of T.

UnitOfWork

Gets a IUnitOfWork that can be used to save instances of T.

protected IUnitOfWork UnitOfWork { get; }

Property Value

IUnitOfWork

The IUnitOfWork that can be used to save instances of T.

Methods

CreateAsync(T, Action<AsyncOptions>)

Creates the specified dto asynchronous in the associated IEfCoreDataSource.

public virtual Task CreateAsync(T dto, Action<AsyncOptions> setup = null)

Parameters

dto T

The object to create in the associated IEfCoreDataSource.

setup Action<AsyncOptions>

The AsyncOptions which may be configured.

Returns

Task

A Task that represents the asynchronous operation.

DeleteAsync(T, Action<AsyncOptions>)

Deletes the specified dto asynchronous in the associated IEfCoreDataSource.

public virtual Task DeleteAsync(T dto, Action<AsyncOptions> setup = null)

Parameters

dto T

The object to delete in the associated IEfCoreDataSource.

setup Action<AsyncOptions>

The AsyncOptions which may be configured.

Returns

Task

A Task that represents the asynchronous operation.

FindAllAsync(Action<EfCoreQueryOptions<T>>)

Finds all objects matching the specified setup asynchronous in the associated IEfCoreDataSource.

public virtual Task<IEnumerable<T>> FindAllAsync(Action<EfCoreQueryOptions<T>> setup = null)

Parameters

setup Action<EfCoreQueryOptions<T>>

The EfCoreQueryOptions<T> which may be configured.

Returns

Task<IEnumerable<T>>

A Task<TResult> that represents the asynchronous operation. The task result either contains the matching objects of the operation or an empty sequence if no match was found.

GetByIdAsync(object, Action<AsyncOptions>)

Loads the object from the specified id asynchronous.

public virtual Task<T> GetByIdAsync(object id, Action<AsyncOptions> setup = null)

Parameters

id object

The key that uniquely identifies the object.

setup Action<AsyncOptions>

The AsyncOptions which may be configured.

Returns

Task<T>

A Task<TResult> that represents the asynchronous operation. The task result either contains the object of the operation or null if not found.

UpdateAsync(T, Action<AsyncOptions>)

Updates the specified dto asynchronous in the associated IEfCoreDataSource.

public virtual Task UpdateAsync(T dto, Action<AsyncOptions> setup = null)

Parameters

dto T

The object to update in the associated IEfCoreDataSource.

setup Action<AsyncOptions>

The AsyncOptions which may be configured.

Returns

Task

A Task that represents the asynchronous operation.

See Also