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
TThe type of the DTO.
TOptionsThe type of options associated with this DTO.
- Inheritance
-
DapperDataStore<T, TOptions>
- Implements
-
IPersistentDataStore<T, TOptions>ISearchableDataStore<T, TOptions>IDataStore<T>
- Derived
- Inherited Members
Constructors
DapperDataStore(IDapperDataSource)
Initializes a new instance of the DapperDataStore<T, TOptions> class.
protected DapperDataStore(IDapperDataSource source)
Parameters
sourceIDapperDataSourceThe 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
dtoTThe object to create in the associated IDapperDataSource.
setupAction<AsyncOptions>The AsyncOptions which may be configured.
Returns
DeleteAsync(T, Action<AsyncOptions>)
Deletes the specified dto asynchronous in the associated IDapperDataSource.
public abstract Task DeleteAsync(T dto, Action<AsyncOptions> setup = null)
Parameters
dtoTThe object to delete in the associated IDapperDataSource.
setupAction<AsyncOptions>The AsyncOptions which may be configured.
Returns
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
setupAction<TOptions>The
TOptionswhich 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
idobjectThe key that uniquely identifies the object.
setupAction<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
nullif 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
dtoTThe object to update in the associated IDapperDataSource.
setupAction<AsyncOptions>The AsyncOptions which may be configured.