Linger.EFCore 0.7.2

There is a newer prerelease version of this package available.
See the version list below for details.
dotnet add package Linger.EFCore --version 0.7.2
                    
NuGet\Install-Package Linger.EFCore -Version 0.7.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="Linger.EFCore" Version="0.7.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Linger.EFCore" Version="0.7.2" />
                    
Directory.Packages.props
<PackageReference Include="Linger.EFCore" />
                    
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 Linger.EFCore --version 0.7.2
                    
#r "nuget: Linger.EFCore, 0.7.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 Linger.EFCore@0.7.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=Linger.EFCore&version=0.7.2
                    
Install as a Cake Addin
#tool nuget:?package=Linger.EFCore&version=0.7.2
                    
Install as a Cake Tool

Linger.EFCore

📝 View this document in: English | 中文

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<ISoftDelete>(e => !e.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

  1. Open the Solution Explorer.
  2. Right-click on a project within your solution.
  3. Click on Manage NuGet Packages....
  4. Click on the Browse tab and search for "Linger.EFCore".
  5. 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 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.  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.

NuGet packages (3)

Showing the top 3 NuGet packages that depend on Linger.EFCore:

Package Downloads
Linger.EFCore.Audit

An Entity Framework Core audit trail library for automatically tracking data changes. Captures entity creation, modification, and deletion events with old and new values. Provides configurable audit logging with support for user tracking and timestamping.

Linger.Audit.EFCore

C# Helper Library

Linger.Repository.EFCore

C# Helper Library

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.9.1-preview 0 9/16/2025
0.9.0-preview 59 9/12/2025
0.8.5-preview 144 8/31/2025
0.8.4-preview 267 8/25/2025
0.8.3-preview 132 8/20/2025
0.8.2-preview 159 8/4/2025
0.8.1-preview 95 7/30/2025
0.8.0-preview 516 7/22/2025
0.7.2 164 6/3/2025
0.7.1 161 5/21/2025
0.7.0 166 5/19/2025
0.6.0-alpha 165 4/28/2025
0.5.0-alpha 160 4/10/2025
0.4.0-alpha 163 4/1/2025
0.3.3-alpha 163 3/19/2025
0.3.2-alpha 159 3/17/2025
0.3.1-alpha 145 3/16/2025
0.3.0-alpha 215 3/6/2025
0.2.0-alpha 107 2/9/2025
0.1.2-alpha 99 12/17/2024
0.1.1-alpha 104 12/9/2024
0.1.0-alpha 97 12/6/2024
0.0.4-alpha 91 12/6/2024
0.0.3-alpha 100 11/27/2024
0.0.2-alpha 92 10/3/2024
0.0.1-alpha 93 9/28/2024