Armudu.EntityFrameworkCore.Atom 6.2.0

dotnet add package Armudu.EntityFrameworkCore.Atom --version 6.2.0
                    
NuGet\Install-Package Armudu.EntityFrameworkCore.Atom -Version 6.2.0
                    
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="Armudu.EntityFrameworkCore.Atom" Version="6.2.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Armudu.EntityFrameworkCore.Atom" Version="6.2.0" />
                    
Directory.Packages.props
<PackageReference Include="Armudu.EntityFrameworkCore.Atom" />
                    
Project file
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 Armudu.EntityFrameworkCore.Atom --version 6.2.0
                    
#r "nuget: Armudu.EntityFrameworkCore.Atom, 6.2.0"
                    
#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 Armudu.EntityFrameworkCore.Atom@6.2.0
                    
#: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=Armudu.EntityFrameworkCore.Atom&version=6.2.0
                    
Install as a Cake Addin
#tool nuget:?package=Armudu.EntityFrameworkCore.Atom&version=6.2.0
                    
Install as a Cake Tool

Armudu

If you've ever worked on projects with multi-tenant, auditable, or soft-deletable tables, you know the pain. You have to constantly add conditions like && TenantId=={someValue} or && !IsDeleted to all of your Entity Framework Core queries.

Managing all those extra conditions can be a huge headache, especially in large projects with tons of queries. If you or a teammate ever forgets to add one of these conditions, you could end up in a world of trouble! 😅

This little library is here to help! Take a look at how it works.

Installation

Use the following commands to install the necessary packages:

dotnet add package Armudu.EntityFrameworkCore.Atom.Contract
dotnet add package Armudu.EntityFrameworkCore.Atom

Usage

If your project uses an architecture like CQRS, and your Entity and DbContext classes are in different layers, you'll need to install the packages this way:

  • Install Armudu.EntityFrameworkCore.Atom.Contract in the layer that holds your entities.
  • Install Armudu.EntityFrameworkCore.Atom in the layer that contains your ApplicationDbContext.

1. Implement IDynamicQueryFilterSource interface on your DbContext

In IDynamicQueryFilterSource interface you have to implement FilterKey object. This object should contain the key for the Entity Framework model caching mechanism. You can set the tenant id or unique value for the current tenant, so the library can apply global filter for the current tenant. Take a look to photo.

RemoteImage

2. Call AddGlobalFilters func

Next, you need to call AddGlobalFilters with your TenantId value not FilterKey object.

Note: Do not miss the FilterKey object and tenant id value should be used for different purposes. FilterKey object is used for a caching mechanism, and tenant id value is used for global filter. Of course, you can use the same value for both purposes.

3. Implement the Contract on Your Entities

In next step, you have to implement the specific contracts you want to use on your entity classes (e.g., IAuditableEntity).

You must also specify the data type (e.g., Guid, int) for the audit user's ID.

4 Call ConfigureStates func

You have to call ConfigureStates in your SaveChanges method of your DbContext.

take a look to photo.. <img src="https://github.com/JavidanValiyev/EntityFrameworkHelper/blob/main/workflows/Screenshot_3.png?raw=true">

5. Replace ModelCacheKeyFactory with DynamicModelCacheKeyFactory

Finally, you have to replace the default ModelCacheKeyFactory with DynamicModelCacheKeyFactory.

options.ReplaceService<IModelCacheKeyFactory, DynamicFilterModelCacheKeyFactory>(); use this line of code on where you write AddDbContext<ApplicationDbContext>(options => options.UseSqlServer(configuration.GetConnectionString("DefaultConnection"))); take a look to photo. <img src="https://github.com/JavidanValiyev/EntityFrameworkHelper/blob/main/workflows/Screenshot_2.png?raw=true">


After you've done this, the library automatically takes care of those boilerplate conditions!

Your queries will now automatically include filters for the current tenant ID and the !IsDeleted condition. No more manual filtering!


Contributing

Pull requests are always welcome! If you have a major change in mind, please open an issue first so we can discuss it before you start coding.

Also, please make sure you update the tests as needed.


License

MIT

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  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.

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
6.2.0 237 12/4/2025
6.1.0 226 12/4/2025
6.0.0 428 11/18/2025
5.1.0 156 11/8/2025
5.0.0 165 11/7/2025
4.0.0 266 11/3/2025 4.0.0 is deprecated because it is no longer maintained.
3.0.0 352 5/6/2023 3.0.0 is deprecated because it is no longer maintained.
2.0.0 575 10/15/2022 2.0.0 is deprecated because it is no longer maintained.
1.0.0 571 7/11/2022 1.0.0 is deprecated because it is no longer maintained.

Hot fix