Sidub.Platform.Filter 1.1.5

The ID prefix of this package has been reserved for one of the owners of this package by NuGet.org. Prefix Reserved
dotnet add package Sidub.Platform.Filter --version 1.1.5
NuGet\Install-Package Sidub.Platform.Filter -Version 1.1.5
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="Sidub.Platform.Filter" Version="1.1.5" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Sidub.Platform.Filter --version 1.1.5
#r "nuget: Sidub.Platform.Filter, 1.1.5"
#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 Sidub.Platform.Filter as a Cake Addin
#addin nuget:?package=Sidub.Platform.Filter&version=1.1.5

// Install Sidub.Platform.Filter as a Cake Tool
#tool nuget:?package=Sidub.Platform.Filter&version=1.1.5

Sidub Platform - Filter

This repository contains the filter module for the Sidub Platform. Filter concept abstractions allow definition of filters while language-specific parser implementations allow for the parsing of filter definitions.

Main Components

Filter Concepts

A filter is represented as an IFilter with FilterPredicate, FilterPipeline and FilterLogicalOperator as the main concrete concepts. The FilterPredicate is the basic building block of a filter and represents a single condition. The FilterPipeline is a collection of IFilter instances and the FilterLogicalOperator is used to combine IFilter instances within the a pipeline.

Filters may be built using the FilterBuilder class which provides a fluent API for building filters.

Filter Parsing

A filter representation can be parsed to its string representation using the appropriate parser. Various language-specific parsers exist to parse filters to appropriate string representations.

Usage

While filters can be manually composed using the respective IFilter implementations, the FilterBuilder class provides a fluent API for building filters. Once prepared, the filter can be parsed to its string representation using the appropriate parser service.

Building a Filter

To build a simple filter, you can use the FilterBuilder as follows:

var builder = new FilterBuilder();
var filter = builder
	.Add("FieldA", ComparisonOperator.Equals, "FieldATestValue")
	.Build();

For filters with multiple conditions, you can use the FilterPipeline and FilterLogicalOperator as follows:

var builder = new FilterBuilder();

var filter = builder
	.Add("FieldA", ComparisonOperator.Equals, "FieldATestValue")
	.Add(LogicalOperator.And)
	.Add("FieldB", ComparisonOperator.NotEquals, "FieldBTestValue");

Pipelines can be nested to create more advanced filters:

var builder = new FilterBuilder();

var filter = builder
	.Add("FieldA", ComparisonOperator.Equals, "FieldATestValue")
	.Add(LogicalOperator.And)
	.Add(inner1 => inner1
		.Add("FieldB", ComparisonOperator.Equals, "FieldBTestValue01")
		.Add(LogicalOperator.Or)
		.Add("FieldB", ComparisonOperator.Equals, "FieldBTestValue02"));

Parsing a Filter

To parse a filter to its string representation, you can use the appropriate parser service. Concrete implementations of the IFilterService<TConfiguration> interface are provided for various languages.

private readonly ODataFilterService _filterService;

public ProductService(ODataFilterService filterService)
{
	_filterService = filterService;
}

public string BuildProductQuery(ProductFilter productFilter)
{
	return _filterService.Parse(filterFilter);
}

Considerations

The library currently only supports implementations in which the filter is parsed to a string representation. Future implemenations will evolve this concept to support more advanced use-cases, such as applying the filter against an in-memory collection or against other query constructs.

License

This project is dual-licensed under the AGPL v3 or a proprietary license. For details, see https://sidub.ca/licensing or the LICENSE.txt file.

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 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 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 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.

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.1.5 109 3/19/2024
1.1.3 84 3/9/2024