Git Product home page Git Product logo

dapper.cqs's Introduction

Dapper.CQS

A simple unit of work implementation on top of Dapper, with some basic CQS in mind.

I've found an awesome project, https://github.com/outmatic/Dapper.UnitOfWork, and I decided to extend some features so that the library can be used more easily. That's why I created this project.

For the query, I have already implemented 3 data types: single, list, paged. You just need to create a Query class, which inherits from 3 respective base classes: QueryBase<T>, QueryListBase<T>, QueryPagedBase<T>.

The following example is a pagination query

public class PropertyPagedFilterQuery : QueryPagedBase<Property>
{
	[Parameter]
	public string? Name { get; set; }
	protected override CommandType CommandType => CommandType.Text;
	protected override string Procedure => @"
SELECT *, COUNT(*) OVER() [COUNT] 
FROM Properties WHERE Name = @Name OR @Name IS NULL
ORDER BY [Name]
OFFSET (@page -1 ) * @pageSize ROWS
FETCH NEXT @pageSize ROWS ONLY
";

	public PropertyPagedFilterQuery(string? name, int page, int pageSize)
	{
		Name = name;
		Page = page;
		PageSize = pageSize;
	}
}

The default CommandType is StoredProcedure, which means you will specify the Procedure property as Stored Procedure in the database.

Take a look at specific examples in the Example project.

Install from nuget

Install-Package Dapper.CQS

dotnet add package Dapper.CQS

dapper.cqs's People

Contributors

giangcoi48k avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.