AegisInt.EntityFrameworkCore
2.0.3
dotnet add package AegisInt.EntityFrameworkCore --version 2.0.3
NuGet\Install-Package AegisInt.EntityFrameworkCore -Version 2.0.3
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.EntityFrameworkCore" Version="2.0.3" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="AegisInt.EntityFrameworkCore" Version="2.0.3" />
<PackageReference Include="AegisInt.EntityFrameworkCore" />
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.EntityFrameworkCore --version 2.0.3
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: AegisInt.EntityFrameworkCore, 2.0.3"
#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.EntityFrameworkCore@2.0.3
#: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.EntityFrameworkCore&version=2.0.3
#tool nuget:?package=AegisInt.EntityFrameworkCore&version=2.0.3
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
AegisInt.EntityFrameworkCore
Dapper Integration for AegisInt.Core
- Automatically applies Value Converters to
EncryptedIntandEncryptedInt?properties so they are stored asINTin the database but used as encrypted structs in your domain.
Installation
dotnet add package AegisInt.EntityFrameworkCore
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. Configure DbContext
Override ConfigureConventions in your DbContext to apply the converter globally.
protected override void ConfigureConventions(ModelConfigurationBuilder configurationBuilder)
{
// Automatically handles all EncryptedInt properties
configurationBuilder.UseAegisIntEncryption();
}
Usage
Once configured with configurationBuilder.UseAegisIntEncryption(), EF Core handles the translation transparently in all LINQ queries.
1. Define your DTO
public class UserDto
{
public EncryptedInt Id { get; set; }
public string Name { get; set; }
}
2. Controller (Automatic Binding)
[ApiController]
[Route("api/[controller]")]
public class UsersController : ControllerBase
{
private readonly IUserRepository _repository;
public UsersController(IUserRepository repository) => _repository = repository;
// GET /api/users/Nk7xR
// "Nk7xR" is automatically decrypted to 101
[HttpGet("{id}")]
public IActionResult Get([FromRoute] EncryptedInt id)
{
var user = _repository.GetById(id);
if (user == null) return NotFound();
return Ok(new UserDto { Id = user.Id, Name = user.Name });
}
}
3. Repository (EntityFrameworkCore)
public class UserRepository : IUserRepository
{
public async Task<UserDto?> GetById(EncryptedInt id)
{
// Generates: SELECT * FROM Users WHERE Id = @id (as int)
return await _context.UsersDto
.FirstOrDefaultAsync(u => u.Id == searchId);
}
public async Task<UserDto> ListUser()
{
return await _context.UserDto.ToList();
}
}
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)
- Microsoft.EntityFrameworkCore (>= 8.0.22)
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.3 | 174 | 12/12/2025 |