Table of Contents

Class DapperDataStore<T, TOptions>

Namespace
Savvyio.Extensions.Dapper
Assembly
Savvyio.Extensions.Dapper.dll

Represents the base class from which all implementations of DapperDataStore<T, TOptions> should derive. This is an abstract class to serve as an abstraction layer before the actual I/O communication with a source of data using Dapper.

public abstract class DapperDataStore<T, TOptions> : Disposable, IDisposable, IPersistentDataStore<T, TOptions>, IWritableDataStore<T>, IReadableDataStore<T>, ISearchableDataStore<T, TOptions>, IDeletableDataStore<T>, IDataStore<T> where T : class where TOptions : AsyncOptions, new()

Type Parameters

T

The type of the DTO.

TOptions

The type of options associated with this DTO.

Inheritance
DapperDataStore<T, TOptions>
Implements
Derived
Inherited Members

Constructors

DapperDataStore(IDapperDataSource)

Initializes a new instance of the DapperDataStore<T, TOptions> class.

protected DapperDataStore(IDapperDataSource source)

Parameters

source IDapperDataSource

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

Properties

Source

Gets the IDapperDataSource that handles actual I/O communication with a source of data.

protected IDapperDataSource Source { get; }

Property Value

IDapperDataSource

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

Methods

CreateAsync(T, Action<AsyncOptions>)

Creates the specified dto asynchronous in the associated IDapperDataSource.

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

Parameters

dto T

The object to create in the associated IDapperDataSource.

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

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

Parameters

dto T

The object to delete in the associated IDapperDataSource.

setup Action<AsyncOptions>

The AsyncOptions which may be configured.

Returns

Task

A Task that represents the asynchronous operation.

FindAllAsync(Action<TOptions>)

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

public abstract Task<IEnumerable<T>> FindAllAsync(Action<TOptions> setup = null)

Parameters

setup Action<TOptions>

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

OnDisposeManagedResources()

Called when this object is being disposed by either Dispose() or Dispose(bool) having disposing set to true and Disposed is false.

protected override void OnDisposeManagedResources()

UpdateAsync(T, Action<AsyncOptions>)

Updates the specified dto asynchronous in the associated IDapperDataSource.

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

Parameters

dto T

The object to update in the associated IDapperDataSource.

setup Action<AsyncOptions>

The AsyncOptions which may be configured.

Returns

Task

A Task that represents the asynchronous operation.

See Also