A reference application written in C# .Net Core which implements the Repository pattern and uses ADO.NET to asynchronously access a SQL Server database. Regression testing of queries and transactions is performed using XUnit.
- Implements the Repository Pattern
- All methods execute asynchronously
- Supports Unit of Work
- Regression tests (query and transaction) via XUnit
- Standard exception Logging
- Supports Paging
- Supports Filtering and Sorting
- Supports queries that return JSON
- Supports queries that return a scalar value
- Supports queries that don't return a value
int FindAllCount()Used to return total row count for query. Used by FindAll with Pager.
ICollection<TEntity> FindAll()Return all rows without criteria, sorting, or paging.
Return a single page with sorting.
IPager<TEntity> FindAll(IPager<TEntity> pager)Return a single page with filter and sorting.
IPager<TEntity> FindAllFiltered(IPager<TEntity> pager)Return a single row using primary key.
TEntity FindByPK(PrimaryKey pk)Add row and return the identity value of the row.
object Add(TEntity entity, PrimaryKey pk)Update row based on Primary Key and return the number of rows affected.
int Delete(TEntity entity, PrimaryKey pk)Soft delete row based on Primary Key return the number of rows affected.
int Update(PrimaryKey pk)Execute a SQL query which does not return a row(s) or only returns an integer value.
int ExecNonQuery(IList<SQLParameter> parms)Execute a SQL Stored Procedure which does not return a row(s) or only returns an integer value.
int ExecStoredProc(IList<SQLParameter> parms)Execute a query which returns a JSON string.
string ExecJSONQuery(IList<SQLParameter> parms)- Solution was upgraded to VS2022 Community Edition
- .Net 6.0
- Updated Microsoft.Data.SqlClient for vulnerability
If the result set is small enought, then just Find All and sort the result. If it's long enough to need paging, then it's built-in.