-
Notifications
You must be signed in to change notification settings - Fork 3
Base Repository Classes
Dennis C. Mitchell edited this page Mar 16, 2019
·
22 revisions
(under construction) EDennis.AspNetCore.Base provides four base repository classes, which cross writeability with temporality. Two of the base repos are writeable and two are readonly. Two of the base repos have temporal support (write to history tables) and two do not have temporal support. The table below summarizes the four repo types.

WriteableRepo provides methods for reading from and writing to current-record tables.
The WriteableRepo constructor accepts two arguments:
- TContext -- any subclass of Entity Framework Core's DbContext
- ScopeProperties -- a class designed to communicate the user name and other data (e.g., headers) from one or more MVC filters to the repo. This class should be dependency injected with a scoped lifetime.
public WriteableRepo(TContext context, ScopeProperties scopeProperties)WriteableRepo provides basic CRUD methods, which automatically save data to the database when needed.
| Method | Description |
|---|---|
public virtual TEntity GetById(params object[] keyValues) |
Retrieve a record by the primary key |
public virtual async Task<TEntity> GetByIdAsync(params object[] keyValues) |
Asynchronous version of GetById |
public virtual bool Exists(params object[] keyValues) |
Determine if a record with the provided key exists |
public virtual async Task<bool> ExistsAsync(params object[] keyValues) |
Asynchronous version of Exists |
(to be continued...)
Development Support
- Temporal Entities
- Base Repository Classes
- Base API Controller Classes
- ApiClient and SecureApiClient
- Security Utilities
- IServiceCollection Extension Methods
- HttpClient Extension Methods
- ScopeProperties
- MigrationsExtensionsDbContextDesignTimeFactory
Testing Support
- API Launcher
- Testing Strategy and Infrastructure
- Xunit Support Classes
- Testing Security Utilities
Related Projects