-
Notifications
You must be signed in to change notification settings - Fork 2
AspNetCore
AspNetCore source allow to get IQuery interface as action method parameter.
Currently, only binding from QueryString is supported.
It is strongly recommended to read about Extensibility in General
Class QueryNinjaModelBinder is responsible for model binding.
It tries to apply each query parameter to any of the IQueryComponentFactory.
Built-in support contains everything needed to work with QueryNinja.Core:
- IDefaultFilter - parameter should look like
filter.{property}.{operation}={value}
. E.g.:filter.Name.Equals=Alex
; - OrderingRule - parameter should look like
order.{property}={direction}
. E.g.:order.Name=Ascending
- Selector -
select={property}
will select property and preserve the path to it andselect.{source}={target}
will take asource
property and put it undertarget
path.
If you will feel that you lack some IQueryComponents here you can easily extend existing behavior by registering own IQueryComponentFactory in QueryNinjaExtensions.
IQueryComponentFactory allows to create IQueryComponent instance from QueryParameter.
For each user-defined IQueryComponents you must have instance of this factory that CanApply
true.
However, process could be simplified if your component is IDIefaultFilter.
DefaultFilterFactory allows to create instances of IDefaultFilter based on default filter patter described above.
It is two independent ways to enable user-defined IDefaultFilters for this factory:
- Register your filter in known components via QueryNinjaExtensions.
⚠️ Your filter must have parameterless constructure with parameters in order: operation, property, value. - Configure factory with IAspNetCoreExtensionSettings
IAspNetCoreExtensionSettings allows to configure DefaultFilterFactory with your own IDefaultFilter.