AspNetCoreOData
AspNetCoreOData copied to clipboard
How to use implementation of FilterBinder without AddRouteComponents?
I have many controllers with ODataQueryOptions<T> parameter for my actions. I don't use ODataModelBuilder for my entities. It works good for my scenario but now I want to use my own implementation of FilterBinder for JsonDocument. How I can use it?
I can't find any abilities to configure any services without using AddRouteComponents.
OData 8.0.9
@osadchii This is a great question. We do need to support that. Before implementation, you maybe achieve it through the following (ugly) workaround:
- Register your IFilterBinder into the global service provider
- Inject into your controller
- In each action,
a) Build a service provider by yourself, inject the required service only, for example, IFilterBinder
b) you have
ODataQueryOptions<T>as a parameter, you can retrieve theContextfrom ODataQueryOptions c) Update the RequestContainer property for theContext, since it's an internal set, you have to use reflection to set the value.
Let me know your trying result.