AegisInt.Dapper
2.0.2
dotnet add package AegisInt.Dapper --version 2.0.2
NuGet\Install-Package AegisInt.Dapper -Version 2.0.2
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="AegisInt.Dapper" Version="2.0.2" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="AegisInt.Dapper" Version="2.0.2" />
<PackageReference Include="AegisInt.Dapper" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add AegisInt.Dapper --version 2.0.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: AegisInt.Dapper, 2.0.2"
#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.
#:package AegisInt.Dapper@2.0.2
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=AegisInt.Dapper&version=2.0.2
#tool nuget:?package=AegisInt.Dapper&version=2.0.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
AegisInt.Dapper
Dapper Integration for AegisInt.Core
- Automatically registers Dapper type handlers for
EncryptedIntandEncryptedInt?so they map toINTcolumns. - Keep DB columns as
INT.
Installation
dotnet add package AegisInt.Dapper
Setup
1. Configure Core (Program.cs)
builder.Services.AddAegisInt(options =>
{
options.Salt = "my-super-secret-production-salt"; // Required
options.Alphabet = "aGbIJK3VWXYcfgmn14opL!MNO#Sqr2D-FEstuhBC9ijk67lvPQRw5dTUexy8zAHZ0"; // optional
options.MinLength = 6; // optional
});
2. Register Dapper Handlers (Program.cs)
// Registers TypeHandlers globally
builder.Services.AddAegisIntDapper();
Usage
Once configured with builder.Services.AddAegisIntDapper(), Dapper automatically handles the conversion between EncryptedInt | EncryptedInt? and your database INT columns.
1. Define your DTO
public class UserDto
{
public EncryptedInt Id { get; set; }
public string Name { get; set; }
}
2. Controller (Automatic Binding)
[ApiController]
[Route("api/users")]
public class UsersController : ControllerBase
{
private readonly IUserRepository _repo;
public UsersController(IUserRepository repo) => _repo = repo;
// GET /api/users/Nk7xR
// "Nk7xR" is automatically decrypted to 101
[HttpGet("{id}")]
public IActionResult Get([FromRoute]EncryptedInt id)
{
var user = _repo.GetById(id);
return Ok(new UserDto { Id = user.Id, Name = user.Name });
}
}
3. Repository (Dapper)
public class UserRepository : IUserRepository
{
// Dapper automatically extracts the INT (101) for the SQL query
public UserDto GetById(EncryptedInt id) =>
_db.QueryFirst<UserDto>("SELECT * FROM Users WHERE Id = @Id", new { Id = id });
public List<UserDto> ListUser() => _db.Query<UserDto>("SELECT * FROM Users").AsList();
}
3. What the Client Sees
Request (GET): GET /api/users/Nk7xR
Response:
{
"id": "Nk7xR",
"name": "John Doe",
"email": "john@example.com"
}
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. 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. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net8.0
- AegisInt.Core (>= 2.0.2)
- Dapper (>= 2.1.66)
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 |
|---|---|---|
| 2.0.2 | 492 | 12/11/2025 |