A lightweight repository pattern built on top of Dapper, providing generic query/list/add/update/upsert/delete operations for SQL Server, plus bulk operations, application locks, and change tracking.
- Simpleverse.Repository – database-agnostic abstractions (
IEntity,IQueryList,IAdd,IUpdate,IUpsert,IReplace,IDelete, etc.). - Simpleverse.Repository.Db – SQL Server / Dapper implementation of those abstractions.
dotnet add package Simpleverse.Repository.Db
using Microsoft.Data.SqlClient;
using Simpleverse.Repository.Db;
using Simpleverse.Repository.Db.Entity;
using Simpleverse.Repository.Db.SqlServer;
// 1. Configure a repository
var repository = new SqlRepository(() => new SqlConnection(connectionString));
// 2. Map a model
[Dapper.Contrib.Extensions.Table("[Identity]")]
public class Identity
{
[Dapper.Contrib.Extensions.Key]
public int Id { get; set; }
public string Name { get; set; }
}
// 3. Query it – declaring a dedicated entity class isn't necessary for a quick
// start. The base Entity.Filter maps "virtual" model properties automatically,
// so the model itself can be used as the filter type.
var entity = new Entity<Identity>(repository, new Table<Identity>("I"));
var results = await entity.ListAsync(filter => filter.Name = "John");See docs/USAGE.md for a full walkthrough covering entity mapping,
TypeMeta configuration, and common usage scenarios such as ListAsync, filtering, and
CRUD operations.