Linger.SharedKernel
2.0.0-preview.5
dotnet add package Linger.SharedKernel --version 2.0.0-preview.5
NuGet\Install-Package Linger.SharedKernel -Version 2.0.0-preview.5
<PackageReference Include="Linger.SharedKernel" Version="2.0.0-preview.5" />
<PackageVersion Include="Linger.SharedKernel" Version="2.0.0-preview.5" />
<PackageReference Include="Linger.SharedKernel" />
paket add Linger.SharedKernel --version 2.0.0-preview.5
#r "nuget: Linger.SharedKernel, 2.0.0-preview.5"
#:package Linger.SharedKernel@2.0.0-preview.5
#addin nuget:?package=Linger.SharedKernel&version=2.0.0-preview.5&prerelease
#tool nuget:?package=Linger.SharedKernel&version=2.0.0-preview.5&prerelease
Linger.SharedKernel
Breaking changes and 2.0 migration notes are documented in the Linger migration guide.
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 : BaseSearchPagedList
{
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 BaseSearchPagedList 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
GetSearchModelExpression now applies SearchParameters as AND conditions, and intersects them with the nonempty OR group in SearchOrParameters. Code relying on these collections being ignored will return fewer rows.
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 | Versions 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. net11.0 is compatible. |
| .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. |
-
.NETFramework 4.7.2
- Linger.Reflection (>= 2.0.0-preview.5)
- Linger.Utils (>= 2.0.0-preview.5)
-
.NETStandard 2.0
- Linger.Reflection (>= 2.0.0-preview.5)
- Linger.Utils (>= 2.0.0-preview.5)
-
net10.0
- Linger.Reflection (>= 2.0.0-preview.5)
- Linger.Utils (>= 2.0.0-preview.5)
-
net11.0
- Linger.Reflection (>= 2.0.0-preview.5)
- Linger.Utils (>= 2.0.0-preview.5)
-
net8.0
- Linger.Reflection (>= 2.0.0-preview.5)
- Linger.Utils (>= 2.0.0-preview.5)
-
net9.0
- Linger.Reflection (>= 2.0.0-preview.5)
- Linger.Utils (>= 2.0.0-preview.5)
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.0-preview.5 | 50 | 11/22/2026 |
| 2.0.0-preview.4 | 65 | 11/14/2026 |
| 2.0.0-preview.3 | 81 | 9/13/2026 |
| 2.0.0-preview.1 | 82 | 8/29/2026 |
| 1.6.4 | 136 | 8/16/2026 |
| 1.6.3 | 119 | 8/5/2026 |
| 1.6.2 | 150 | 8/2/2026 |
| 1.6.0 | 138 | 7/25/2026 |
| 1.5.5 | 127 | 7/23/2026 |
| 1.5.4-preview | 119 | 7/21/2026 |
| 1.5.3-preview | 122 | 7/20/2026 |
| 1.5.2-preview | 126 | 7/19/2026 |
| 1.5.1-preview | 116 | 7/15/2026 |
| 1.5.0-preview | 122 | 7/14/2026 |
| 1.4.4-preview | 199 | 6/16/2026 |
| 1.4.3-preview | 118 | 6/15/2026 |
| 1.4.2 | 136 | 5/20/2026 |
| 1.4.1-preview | 123 | 5/12/2026 |
| 1.4.0 | 123 | 5/6/2026 |
| 1.3.3-preview | 114 | 5/5/2026 |