Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

157 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Simpleverse.Repository

build

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.

Packages

  • Simpleverse.Repository – database-agnostic abstractions (IEntity, IQueryList, IAdd, IUpdate, IUpsert, IReplace, IDelete, etc.).
  • Simpleverse.Repository.Db – SQL Server / Dapper implementation of those abstractions.

Install

dotnet add package Simpleverse.Repository.Db

Quick start

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");

Documentation

See docs/USAGE.md for a full walkthrough covering entity mapping, TypeMeta configuration, and common usage scenarios such as ListAsync, filtering, and CRUD operations.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

Packages

Used by

Contributors

Languages