| | | 1 | | using Microsoft.AspNetCore.Mvc; |
| | | 2 | | using Microsoft.Extensions.DependencyInjection; |
| | | 3 | | using Plainquire.Filter.Mvc.ModelBinders; |
| | | 4 | | |
| | | 5 | | namespace Plainquire.Filter.Mvc; |
| | | 6 | | |
| | | 7 | | /// <summary> |
| | | 8 | | /// Extensions to register entity filter extensions to MVC |
| | | 9 | | /// </summary> |
| | | 10 | | public static class MvcBuilderExtensions |
| | | 11 | | { |
| | | 12 | | /// <summary> |
| | | 13 | | /// Registers filter expression specific model binders. |
| | | 14 | | /// </summary> |
| | | 15 | | /// <param name="mvcBuilder">The MVC builder.</param> |
| | | 16 | | /// <autogeneratedoc /> |
| | | 17 | | public static IMvcBuilder AddFilterSupport(this IMvcBuilder mvcBuilder) |
| | | 18 | | { |
| | 6 | 19 | | mvcBuilder.Services.Configure<MvcOptions>(options => |
| | 6 | 20 | | { |
| | 6 | 21 | | options.ModelBinderProviders.Insert(0, new EntityFilterModelBinderProvider()); |
| | 6 | 22 | | options.ModelBinderProviders.Insert(0, new EntityFilterSetModelBinderProvider()); |
| | 6 | 23 | | }); |
| | | 24 | | |
| | 6 | 25 | | return mvcBuilder; |
| | | 26 | | } |
| | | 27 | | } |