Class EfCoreDbContext<TDbContext>
An implementation of IDbContext that works with Entity Framework Core.
Implements
Inherited Members
Namespace: Silverback.Database
Assembly: Silverback.Core.EFCore30.dll
Syntax
public class EfCoreDbContext<TDbContext> : IDbContext where TDbContext : DbContext
Type Parameters
| Name | Description |
|---|---|
| TDbContext | The type of the underlying DbContext. |
Constructors
| Improve this doc View sourceEfCoreDbContext(TDbContext)
Initializes a new instance of the EfCoreDbContext<TDbContext> class.
Declaration
public EfCoreDbContext(TDbContext dbContext)
Parameters
| Type | Name | Description |
|---|---|---|
| TDbContext | dbContext | The wrapped DbContext. |
Methods
| Improve this doc View sourceGetDbSet<TEntity>()
Returns an IDbSet<TEntity> for the specified entity type.
Declaration
public IDbSet<TEntity> GetDbSet<TEntity>() where TEntity : class
Returns
| Type | Description |
|---|---|
| IDbSet<TEntity> | An IDbSet<TEntity>. |
Type Parameters
| Name | Description |
|---|---|
| TEntity | The type of the entity. |
SaveChanges()
Saves all changes made in this context to the database.
Declaration
public void SaveChanges()
SaveChangesAsync()
Saves all changes made in this context to the database.
Declaration
public Task SaveChangesAsync()
Returns
| Type | Description |
|---|---|
| Task | A Task representing the asynchronous operation. |