| | 1 | | using Microsoft.AspNetCore.Mvc.ModelBinding; |
| | 2 | | using Microsoft.AspNetCore.Mvc.ModelBinding.Binders; |
| | 3 | | using System; |
| | 4 | |
|
| | 5 | | namespace Plainquire.Filter.Mvc.ModelBinders; |
| | 6 | |
|
| | 7 | | /// <summary> |
| | 8 | | /// Model binding provider for <see cref="EntityFilterModelBinder"/> |
| | 9 | | /// </summary> |
| | 10 | | public class EntityFilterModelBinderProvider : IModelBinderProvider |
| | 11 | | { |
| | 12 | | /// <inheritdoc /> |
| | 13 | | public IModelBinder? GetBinder(ModelBinderProviderContext context) |
| | 14 | | { |
| 4 | 15 | | if (context == null) |
| 0 | 16 | | throw new ArgumentNullException(nameof(context)); |
| | 17 | |
|
| 4 | 18 | | return context.Metadata.ModelType.IsGenericEntityFilter() |
| 4 | 19 | | ? new BinderTypeModelBinder(typeof(EntityFilterModelBinder)) |
| 4 | 20 | | : null; |
| | 21 | | } |
| | 22 | | } |