Linger.SharedKernel 0.9.9

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

Linger.SharedKernel

📝 View this document in: English | 中文

Overview

Linger.SharedKernel provides the core domain primitives and shared abstractions for building applications with the Linger framework. It serves as a foundation for implementing Domain-Driven Design (DDD) patterns across multiple projects.

Features

  • Base search models for building rich query capabilities
  • Expression-based filtering system
  • Pagination support with sorting and filtering
  • Reusable domain abstractions
  • Cross-cutting concerns like searching and pagination

Installation

dotnet add package Linger.SharedKernel

Usage

Basic Search Implementation

// Create a domain-specific search model
public class UserSearch : BaseSearch
{
    public string? Username { get; set; }
    public DateTime? RegistrationDateFrom { get; set; }
    public DateTime? RegistrationDateTo { get; set; }
    
    // Optional: Override methods to add custom filtering logic
    public override Expression<Func<User, bool>> GetSearchModelExpression<User>()
    {
        var expression = base.GetSearchModelExpression<User>();
        
        // Add custom conditions
        if (!Username.IsNullOrEmpty())
        {
            this.SearchParameters.Add(new Condition
            {
                Field = nameof(Username),
                Operator = Operators.Contains,
                Value = Username
            });
        }
        
        if (RegistrationDateFrom.HasValue)
        {
            this.SearchParameters.Add(new Condition
            {
                Field = nameof(RegistrationDate),
                Operator = Operators.GreaterThanOrEqual,
                Value = RegistrationDateFrom
            });
        }
        
        return expression;
    }
}

Implementing Paged Searches

// Create a paged search model
public class ProductPagedSearch : BaseSearchPageList
{
    public decimal? MinPrice { get; set; }
    public decimal? MaxPrice { get; set; }
    public string? Category { get; set; }
}

// Using the search model in a repository or service
public class ProductService
{
    private readonly IRepository<Product> _repository;
    
    public ProductService(IRepository<Product> repository)
    {
        _repository = repository;
    }
    
    public async Task<PagedResult<ProductDto>> SearchProductsAsync(ProductPagedSearch search)
    {
        // The BaseSearchPageList properties will handle pagination
        var expression = search.GetSearchModelExpression<Product>();
        
        // Apply the search expression
        var query = _repository.Query().Where(expression);
        
        // Apply sorting if specified
        if (!string.IsNullOrEmpty(search.Sorting))
        {
            query = query.ApplySorting(search.Sorting);
        }
        
        // Apply pagination
        var totalCount = await query.CountAsync();
        var items = await query
            .Skip((search.PageIndex - 1) * search.PageSize)
            .Take(search.PageSize)
            .ToListAsync();
            
        return new PagedResult<ProductDto>(
            items.Select(p => new ProductDto(p)),
            totalCount,
            search.PageIndex,
            search.PageSize
        );
    }
}

Advanced Filtering with Conditions

var search = new BaseSearch();

// Add conditions programmatically
search.SearchParameters.Add(new Condition 
{
    Field = "Name",
    Operator = Operators.Contains,
    Value = "John"
});

search.SearchParameters.Add(new Condition 
{
    Field = "Age",
    Operator = Operators.GreaterThan,
    Value = 18
});

// Add OR conditions
search.SearchOrParameters.Add(new Condition 
{
    Field = "Email",
    Operator = Operators.EndsWith,
    Value = "@gmail.com"
});

search.SearchOrParameters.Add(new Condition 
{
    Field = "Email",
    Operator = Operators.EndsWith,
    Value = "@outlook.com"
});

// Apply to a LINQ query
var expression = search.GetSearchModelExpression<Customer>();
var results = dbContext.Customers.Where(expression).ToList();

Dependencies

  • Linger (core package)

Target Frameworks

  • .NET Framework 4.7.2+
  • .NET Standard 2.0+
  • .NET 8.0+
  • .NET 9.0+
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  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 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. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 is compatible.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos 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
0.9.9 108 10/16/2025
0.9.8 117 10/14/2025
0.9.7-preview 147 10/13/2025
0.9.6-preview 131 10/12/2025
0.9.5 136 9/28/2025
0.9.4-preview 161 9/25/2025
0.9.3-preview 164 9/22/2025
0.9.1-preview 270 9/16/2025
0.9.0-preview 107 9/12/2025
0.8.5-preview 173 8/31/2025
0.8.4-preview 292 8/25/2025
0.8.3-preview 141 8/20/2025
0.8.2-preview 164 8/4/2025
0.8.1-preview 113 7/30/2025
0.8.0-preview 546 7/22/2025
0.7.2 163 6/3/2025
0.7.1 168 5/21/2025
0.7.0 166 5/19/2025
0.6.0-alpha 166 4/28/2025
0.5.0-alpha 180 4/10/2025
0.4.0-alpha 167 4/1/2025
0.3.3-alpha 180 3/19/2025
0.3.2-alpha 165 3/17/2025
0.3.1-alpha 152 3/16/2025
0.3.0-alpha 242 3/6/2025
0.1.2-alpha 110 12/17/2024
0.1.1-alpha 121 12/17/2024
0.1.0-alpha 111 12/6/2024
0.0.4-alpha 106 12/6/2024
0.0.3-alpha 111 11/27/2024
0.0.2-alpha 106 10/3/2024
0.0.1-alpha 107 9/28/2024