Class EfCoreDataSource
- Namespace
- Savvyio.Extensions.EFCore
- Assembly
- Savvyio.Extensions.EFCore.dll
Provides a default implementation of the IEfCoreDataSource interface to support the actual I/O communication with a source of data using Microsoft Entity Framework Core.
public class EfCoreDataSource : Disposable, IDisposable, IEfCoreDataSource, IDataSource, IUnitOfWork
- Inheritance
-
EfCoreDataSource
- Implements
- Derived
- Inherited Members
Constructors
EfCoreDataSource(DbContext)
Initializes a new instance of the EfCoreDataSource class.
protected EfCoreDataSource(DbContext dbContext)
Parameters
EfCoreDataSource(EfCoreDataSourceOptions)
Initializes a new instance of the EfCoreDataSource class.
public EfCoreDataSource(EfCoreDataSourceOptions options)
Parameters
optionsEfCoreDataSourceOptionsThe EfCoreDataSourceOptions used to configure this instance.
Properties
DbContext
Gets the session of this data source.
public DbContext DbContext { get; }
Property Value
- DbContext
The session of this data source.
Methods
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()
SaveChangesAsync(Action<AsyncOptions>)
Saves the different IRepository<TEntity, TKey> implementations as one transaction towards a data store asynchronous.
public virtual Task SaveChangesAsync(Action<AsyncOptions> setup = null)
Parameters
setupAction<AsyncOptions>The AsyncOptions which may be configured.
Returns
Set<TEntity>()
Creates a DbSet<TEntity> that can be used to query and save instances of TEntity.
public DbSet<TEntity> Set<TEntity>() where TEntity : class
Returns
- DbSet<TEntity>
A set for the given entity type.
Type Parameters
TEntityThe type of entity for which a set should be returned.