ReHackt.Linq.AutoMapper
8.0.102
See the version list below for details.
dotnet add package ReHackt.Linq.AutoMapper --version 8.0.102
NuGet\Install-Package ReHackt.Linq.AutoMapper -Version 8.0.102
<PackageReference Include="ReHackt.Linq.AutoMapper" Version="8.0.102" />
<PackageVersion Include="ReHackt.Linq.AutoMapper" Version="8.0.102" />
<PackageReference Include="ReHackt.Linq.AutoMapper" />
paket add ReHackt.Linq.AutoMapper --version 8.0.102
#r "nuget: ReHackt.Linq.AutoMapper, 8.0.102"
#:package ReHackt.Linq.AutoMapper@8.0.102
#addin nuget:?package=ReHackt.Linq.AutoMapper&version=8.0.102
#tool nuget:?package=ReHackt.Linq.AutoMapper&version=8.0.102
ReHackt.Linq
Some useful System.Linq.IQueryable extensions such as filtering, ordering, paging...
Install
Get it on <a href="https://www.nuget.org/packages/ReHackt.Linq"><img src="https://www.nuget.org/Content/gallery/img/default-package-icon.svg" height=18 style="height:18px;" /> NuGet</a>
QueryableFilter
QueryableFilter<T> allows to dynamically filter an IQueryable<T> with a query string. For example, this can be useful for an API whose clients can filter a collection of entities on any of its properties, or create complex logical queries.
For example
string query = @"Name eq ""Bond"" and (""james"" in Email or (Status in [1, 2] and ""007"" in Codes)) and (Amount lt 1000 or IsEnabled eq false)";
if(QueryableFilter.TryParse(query, out QueryableFilter<Agent> filter) {
IQueryable<Agent> agents = _agentManager.Agents.Filter(filter);
}
else { /* Handle invalid query */ };
Is equivalent to
IQueryable<Agent> agents = _agentManager.Agents
.Where(u => u.Name == "Bond"
&& (u.Email.Contains("james")
|| (new int[] { 1, 2 }.Contains(Status) && u.Codes.Contains("007")))
&& (u.Amount < 1000 || u.IsEnabled == false);
Supported in query
- Boolean operators: and, or, not
- Comparison operators: eq, ne, gt, gte (ge), lt, lte (le), in (
string.ContainsorIList.Contains) - Value types: bool?, DateTimeOffset?, double?, int?, enum, null, string, DateTimeOffset?[], double?[], int?[], string[]
- Parentheses
- Property names (nested properties and collection properties supported)
IQueryable extensions
Filtering
Filter
Filter allows to apply a QueryableFilter<T> to the input sequence using LINQ method syntax.
source.Filter(filter) // filter is a QueryableFilter<T>
Is syntactic sugar for
filter.Apply(source)
This method also allows you to directly filter the input sequence with a query string (implicitly creating a QueryableFilter<T>). Be careful, this can throw an argument exception if the query string is not valid.
source.Filter(filterQuery) // filterQuery is a string
Is syntactic sugar for
QueryableFilter.TryParse(filterQuery, out QueryableFilter<T> filter) ?
source.Filter(filter) :
throw new ArgumentException("Invalid filter query", nameof(filterQuery))
WhereIf
source.WhereIf(condition, predicate)
Is syntactic sugar for
condition ? source.Where(predicate) : source
This allows you to keep the LINQ method syntax to apply filters according to a condition that does not depend on the element being tested.
For example
return source
.Join(...)
.Where(...)
.WhereIf(condition1, predicate1)
.WhereIf(condition2, predicate2)
.OrderBy(...)
.Select(...);
Is equivalent to
source = source
.Join(...)
.Where(...);
if(condition1) {
source = source.Where(predicate1);
}
if(condition2) {
source = source.Where(predicate2);
}
return source
.OrderBy(...)
.Select(...);
Ordering
// TODO Write documentation of Sort(...)
Paging
PageBy
source.PageBy(page, pageSize)
Is syntactic sugar for
source.Skip(((page < 1 ? 1 : page) - 1) * pageSize).Take(pageSize)
| 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 was computed. 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. |
-
net8.0
- AutoMapper (>= 14.0.0)
- AutoMapper.Extensions.ExpressionMapping (>= 8.0.0)
- ReHackt.Linq (>= 8.0.102)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on ReHackt.Linq.AutoMapper:
| Package | Downloads |
|---|---|
|
ReHackt.AspNetCore.AutoMapper
Package Description |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 8.0.139 | 431 | 12/16/2025 |
| 8.0.138 | 416 | 11/14/2025 |
| 8.0.137 | 398 | 11/13/2025 |
| 8.0.136 | 433 | 11/12/2025 |
| 8.0.135 | 333 | 10/15/2025 |
| 8.0.134 | 309 | 10/7/2025 |
| 8.0.133 | 313 | 9/10/2025 |
| 8.0.132 | 277 | 9/10/2025 |
| 8.0.131 | 280 | 9/10/2025 |
| 8.0.130 | 293 | 9/10/2025 |
| 8.0.129 | 310 | 9/1/2025 |
| 8.0.128 | 311 | 8/20/2025 |
| 8.0.127 | 314 | 8/18/2025 |
| 8.0.126 | 336 | 8/15/2025 |
| 8.0.125 | 274 | 8/15/2025 |
| 8.0.124 | 292 | 8/14/2025 |
| 8.0.123 | 293 | 8/14/2025 |
| 8.0.122 | 293 | 8/14/2025 |
| 8.0.121 | 307 | 8/13/2025 |
| 8.0.102 | 311 | 3/28/2025 |