DataFilters.AspNetCore
0.2.0
See the version list below for details.
dotnet add package DataFilters.AspNetCore --version 0.2.0
NuGet\Install-Package DataFilters.AspNetCore -Version 0.2.0
<PackageReference Include="DataFilters.AspNetCore" Version="0.2.0" />
paket add DataFilters.AspNetCore --version 0.2.0
#r "nuget: DataFilters.AspNetCore, 0.2.0"
// Install DataFilters.AspNetCore as a Cake Addin #addin nuget:?package=DataFilters.AspNetCore&version=0.2.0 // Install DataFilters.AspNetCore as a Cake Tool #tool nuget:?package=DataFilters.AspNetCore&version=0.2.0
DataFilters.AspNetCore
A small library that ease usage of DataFilters with ASP.NET Core APIs.
<a href="#" id="lnk-why">Why</a>
Make it easier to build IFilter
instances
DataFilters allows to build complex queries in a "restfull" way so However, it comes with some drawbacks.
In order to build a filter, you have to :
- parse the incoming string
- map it manually to an underlying model type.
- converts it into an IFilter instance using the
ToFilter<T>
extension method.
This can be a tedious task and this library can help to ease that process.
Limit the bandwith usage
The library adds support for two custom HTTP headers : x-datafilters-fields-include
and x-datafilters-fields-exclude
.
x-datafilters-fields-include
x-datafilters-fields-include
custom HTTP header allows to specified which properties that will be kept in the body response.
x-datafilters-fields-exclude
x-datafilters-fields-exclude
custom HTTP header allows to specify which properties that will be
dropped from the body response.
These custom headers can be handy for mobile clients that query a REST API by reducing the volume of data transfered from backend. This can also allow to design one API that can serve multiple clients : each client could "select" the properties it want to display.
Improve performances
The library caches IFilter
instances created by the service.
<a href='#' id='how-to-install'>How to install</a>
- run
dotnet install DataFilters.AspNetCore
to add the package to your solution - add the following line to your Startup.cs file
public void ConfigureServices(IServiceCollection services)
{
services.AddDataFilterService(options =>
{
// configure DataFiltersOptions
});
}
This will add IDataFilterService
as a singleton to the dependency injection container.
- You can also opt in to use the custom HTTP headers by adding and instance of
SelectPropertiesActionFilterAttribute
services.Filters.Add(new SelectPropertyFilterAttribute());
This will then enable usage of x-datafilters-fields-include
and x-datafilters-fields-exclude
HTTP headers
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. |
.NET Core | netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.1 is compatible. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.1
- DataFilters (>= 0.11.0)
- Microsoft.AspNetCore.Mvc.Core (>= 2.2.5)
- Microsoft.Extensions.Caching.Memory (>= 5.0.0)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 5.0.0)
-
net5.0
- DataFilters (>= 0.11.0)
- Microsoft.AspNetCore.Mvc.Core (>= 2.2.5)
- Microsoft.Extensions.Caching.Memory (>= 5.0.0)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 5.0.0)
-
net6.0
- DataFilters (>= 0.11.0)
- Microsoft.AspNetCore.Mvc.Core (>= 2.2.5)
- Microsoft.Extensions.Caching.Memory (>= 5.0.0)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 6.0.0)
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.4.0 | 2,915 | 8/17/2022 |
0.3.0 | 443 | 8/14/2022 |
0.2.0 | 571 | 3/29/2022 |
0.1.0 | 388 | 5/16/2021 |
0.1.0-beta0001 | 294 | 5/15/2021 |
• Bumped [Candoumbe.MiscUtilities](https://nuget.org/packages/Candoumbe.MiscUtilities) to [0.6.3](https://nuget.org/packages/Candoumbe.DataFilters/0.8.0)
• Bumped [DataFilters](https://nuget.org/packages/DataFilters) to [0.11.0](https://nuget.org/packages/Candoumbe/DataFilters/0.8.0)
• Dropped FluentAssertions dependency
• Improved overall documentation
Full changelog at https://github.com/candoumbe/DataFilters.AspNetCore/blob/main/CHANGELOG.md