| | 1 | | using Microsoft.AspNetCore.Mvc; |
| | 2 | | using Microsoft.Extensions.DependencyInjection; |
| | 3 | | using Plainquire.Filter.Newtonsoft; |
| | 4 | |
|
| | 5 | | namespace Plainquire.Filter.Mvc.Newtonsoft; |
| | 6 | |
|
| | 7 | | /// <summary> |
| | 8 | | /// Extensions to register entity filter extensions to MVC |
| | 9 | | /// </summary> |
| | 10 | | public static class MvcBuilderExtensions |
| | 11 | | { |
| | 12 | | /// <summary> |
| | 13 | | /// Adds support to serialize/deserialize filter expression related classes to MVC pipeline. |
| | 14 | | /// </summary> |
| | 15 | | /// <param name="mvcBuilder">The MVC builder.</param> |
| | 16 | | /// <autogeneratedoc /> |
| | 17 | | public static IMvcBuilder AddFilterNewtonsoftSupport(this IMvcBuilder mvcBuilder) |
| | 18 | | { |
| 5 | 19 | | mvcBuilder.Services.Configure<MvcNewtonsoftJsonOptions>(options => |
| 5 | 20 | | { |
| 5 | 21 | | options.SerializerSettings.Converters.AddFilterNewtonsoftSupport(); |
| 5 | 22 | | }); |
| | 23 | |
|
| 5 | 24 | | return mvcBuilder; |
| | 25 | | } |
| | 26 | | } |