Linger.EFCore
0.2.0-alpha
This is a prerelease version of Linger.EFCore.
dotnet add package Linger.EFCore --version 0.2.0-alpha
NuGet\Install-Package Linger.EFCore -Version 0.2.0-alpha
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="Linger.EFCore" Version="0.2.0-alpha" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Linger.EFCore --version 0.2.0-alpha
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Linger.EFCore, 0.2.0-alpha"
#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 Linger.EFCore as a Cake Addin #addin nuget:?package=Linger.EFCore&version=0.2.0-alpha&prerelease // Install Linger.EFCore as a Cake Tool #tool nuget:?package=Linger.EFCore&version=0.2.0-alpha&prerelease
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Linger.EFCore
A C# Entity Framework Core helper library that provides enhanced query filter capabilities and property conversion extensions for .NET 9.0 and .NET 8.0.
Introduction
Linger.EFCore extends Entity Framework Core with powerful features including global query filters and property type conversions, making it easier to work with complex data types and filtering scenarios.
Features
Global Query Filters
- Apply filters automatically to entities implementing specific interfaces
- Apply filters based on property values
- Type-safe filter expressions
- Supports all Entity Framework Core query scenarios
Property Conversions
- JSON serialization support for complex types
- Conversion for string collections
- Custom value comparers
- Flexible configuration options
Usage Examples
JSON Property Conversion
public class User
{
public int Id { get; set; }
public UserSettings? Settings { get; set; }
}
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.Entity<User>().Property(x => x.Settings).HasJsonConversion();
}
String Collection Conversion
public class Product
{
public int Id { get; set; }
public ICollection? Tags { get; set; }
}
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.Entity<Product>().Property(x => x.Tags).HasStringCollectionConversion(separator: ",");
}
Interface-based Filtering
// Define your interface
public interface ISoftDelete { bool IsDeleted { get; set; } }
// Implement the interface in your entities
public class User : ISoftDelete
{
public int Id { get; set; }
public string Name { get; set; }
public bool IsDeleted { get; set; }
}
// Apply the filter in your DbContext
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
// This will automatically filter out soft-deleted entities
modelBuilder.ApplyGlobalFilters(x => !x.IsDeleted);
}
Property-based Filtering
// Multi-tenant filtering example
public class ApplicationDbContext : DbContext
{
private readonly int _currentTenantId;
public ApplicationDbContext(int currentTenantId)
{
_currentTenantId = currentTenantId;
}
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
// This will automatically filter entities by tenant
modelBuilder.ApplyGlobalFilters("TenantId", _currentTenantId);
}
}
Install
From Visual Studio
- Open the
Solution Explorer
. - Right-click on a project within your solution.
- Click on
Manage NuGet Packages...
. - Click on the
Browse
tab and search for "Linger.EFCore". - Click on the
Linger.EFCore
package, select the appropriate version and click Install.
Package Manager Console
PM> Install-Package Linger.EFCore
.NET CLI Console
> dotnet add package Linger.EFCore
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 is compatible. 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. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net8.0
- Linger.Utils (>= 0.2.0-alpha)
- Microsoft.EntityFrameworkCore (>= 9.0.1)
-
net9.0
- Linger.Utils (>= 0.2.0-alpha)
- Microsoft.EntityFrameworkCore (>= 9.0.1)
NuGet packages (3)
Showing the top 3 NuGet packages that depend on Linger.EFCore:
Package | Downloads |
---|---|
Linger.Audit.EFCore
C# Helper Library |
|
Linger.Repository.EFCore
C# Helper Library |
|
Linger.EFCore.Audit
C# Helper Library |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
0.2.0-alpha | 34 | 2/9/2025 |
0.1.2-alpha | 52 | 12/17/2024 |
0.1.1-alpha | 57 | 12/9/2024 |
0.1.0-alpha | 53 | 12/6/2024 |
0.0.4-alpha | 49 | 12/6/2024 |
0.0.3-alpha | 56 | 11/27/2024 |
0.0.2-alpha | 52 | 10/3/2024 |
0.0.1-alpha | 54 | 9/28/2024 |