Philo.Search
1.3.0
.NET 5.0
This package targets .NET 5.0. The package is compatible with this framework or higher.
.NET Standard 2.0
This package targets .NET Standard 2.0. The package is compatible with this framework or higher.
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package Philo.Search --version 1.3.0
NuGet\Install-Package Philo.Search -Version 1.3.0
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="Philo.Search" Version="1.3.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Philo.Search --version 1.3.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Philo.Search, 1.3.0"
#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 Philo.Search as a Cake Addin #addin nuget:?package=Philo.Search&version=1.3.0 // Install Philo.Search as a Cake Tool #tool nuget:?package=Philo.Search&version=1.3.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Philo.Search
Automated filter and sort of Queryable objects. Useful for automatically generating the Where clause of an IQueryable such as for LINQ to SQL.
Setup
Add the search service to your Startup.cs
services.AddScoped<ISearchService, SearchService>();
Inject the ISearchService as you would any other dependency to where you plan on using it.
Your front end should build the filters, but to test we can create our own:
var filterSet = new FilterSet
{
PageNumber = 1,
PageSize = 10,
SortBy = "code",
SortDir = "Description",
Filter = new FilterGroup
{
Operator = FilterOperator.Or,
Filters = new List<Filter>
{
new Filter
{
Action = Comparator.Like,
Field = "code",
Value = "test"
}
},
FilterGroups = new List<FilterGroup>()
}
};
EntityFramework
var query = dbContext.EntityTypes
.Include(c => c.RelatedMember)
.AsNoTracking()
.AsQueryable();
var searchRes = searchService.DoSearch<EntityType>(query, filterSet, GetMappings());
and build your mappings.
public List<IMapAFilter<EntityType>> GetMappings()
{
return new List<IMapAFilter<EntityType>>
{
new FilterMapping<EntityType, Guid>("id", et => et.Id) { IsDefaultSortFilter = true },
new FilterMapping<EntityType, string>("code", et => et.Code),
new FilterMapping<EntityType, string>("description", et => et.Description),
// you can construct simple computed fields
new FilterMapping<EntityType, string>("fullName", et => u.Code + " " + u.Description),
// Map Collections
new CollectionMapping<EntityType>(
"userName"
)
.Any(et => et.Users)
.Property(u => u.FirstName + " " + u.LastName)
};
}
Computed Column
new FilterMapping<EntityType, string>("fullName", et => u.Code + " " + u.Description)
Count a Collection with fixed filter values
// count the number of paid orders a customer has
new FilterMapping<Customer, int>("paidOrderCount", a => a.Orders.Where(o => o.Status == OrderStatus.Processing || o.Status == OrderStatus.Processed || o.Status == OrderStatus.InTransit || o.Status == OrderStatus.Delivered).Count()),
Filter a Collection before Checking Any
new CollectionMapping<EntityType>(
"adminUserName"
)
.Any(et => et.Users.Where(u => u.Role == UserRole.Admin))
.Property(u => u.FirstName + " " + u.LastName)
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 is compatible. net5.0-windows was computed. net6.0 is compatible. 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 was computed. 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. |
.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 is compatible. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. 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.
-
.NETStandard 2.0
- LINQKit.Core (>= 1.1.21)
-
.NETStandard 2.1
- LINQKit.Core (>= 1.1.21)
-
net5.0
- LINQKit.Core (>= 1.1.21)
-
net6.0
- LINQKit.Core (>= 1.1.21)
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 |
---|---|---|
1.3.7 | 6,407 | 12/19/2023 |
1.3.6 | 122 | 12/19/2023 |
1.3.5 | 1,919 | 5/30/2022 |
1.3.4 | 439 | 5/30/2022 |
1.3.3 | 5,735 | 3/30/2022 |
1.3.2 | 435 | 3/30/2022 |
1.3.1 | 419 | 3/30/2022 |
1.3.0 | 431 | 11/12/2021 |
1.2.6 | 2,631 | 1/13/2021 |
1.2.5 | 522 | 12/3/2020 |
1.2.4 | 406 | 12/3/2020 |
1.2.2 | 524 | 9/9/2020 |
1.2.1 | 448 | 9/9/2020 |
1.2.0 | 503 | 8/3/2020 |
1.1.9 | 526 | 8/2/2020 |
1.1.7 | 545 | 4/26/2020 |
1.1.6 | 462 | 4/25/2020 |
1.1.5 | 564 | 3/1/2020 |
1.1.4 | 555 | 2/28/2020 |
1.1.3 | 552 | 2/28/2020 |
1.1.2 | 589 | 2/15/2020 |
1.1.1 | 541 | 2/5/2020 |
1.1.0 | 752 | 1/31/2020 |
1.0.8 | 499 | 10/3/2019 |
1.0.7 | 508 | 9/19/2019 |
1.0.6 | 510 | 9/19/2019 |
1.0.5 | 543 | 9/18/2019 |
1.0.4 | 535 | 9/18/2019 |
1.0.3 | 498 | 9/18/2019 |
1.0.2 | 479 | 9/17/2019 |
1.0.0 | 579 | 9/16/2019 |