Dapper.CQS 1.0.1

dotnet add package Dapper.CQS --version 1.0.1
NuGet\Install-Package Dapper.CQS -Version 1.0.1
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Dapper.CQS" Version="1.0.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Dapper.CQS --version 1.0.1
#r "nuget: Dapper.CQS, 1.0.1"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Dapper.CQS as a Cake Addin
#addin nuget:?package=Dapper.CQS&version=1.0.1

// Install Dapper.CQS as a Cake Tool
#tool nuget:?package=Dapper.CQS&version=1.0.1

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

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 is compatible. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.1 324 12/20/2021
1.0.0 2,982 11/25/2021