| | | 1 | | using Microsoft.AspNetCore.Mvc; |
| | | 2 | | using Microsoft.Extensions.DependencyInjection; |
| | | 3 | | using Plainquire.Page.Newtonsoft; |
| | | 4 | | using System.Diagnostics.CodeAnalysis; |
| | | 5 | | |
| | | 6 | | namespace Plainquire.Page.Mvc.Newtonsoft; |
| | | 7 | | |
| | | 8 | | /// <summary> |
| | | 9 | | /// Extensions to register entity page extensions to MVC |
| | | 10 | | /// </summary> |
| | | 11 | | [SuppressMessage("ReSharper", "UnusedMethodReturnValue.Global", Justification = "Provided as library, can be used from o |
| | | 12 | | public static class MvcBuilderExtensions |
| | | 13 | | { |
| | | 14 | | /// <summary> |
| | | 15 | | /// Adds support to serialize/deserialize page related classes to MVC pipeline. |
| | | 16 | | /// </summary> |
| | | 17 | | /// <param name="mvcBuilder">The MVC builder.</param> |
| | | 18 | | /// <autogeneratedoc /> |
| | | 19 | | public static IMvcBuilder AddPageNewtonsoftSupport(this IMvcBuilder mvcBuilder) |
| | | 20 | | { |
| | 5 | 21 | | mvcBuilder.Services.Configure<MvcNewtonsoftJsonOptions>(options => |
| | 5 | 22 | | { |
| | 5 | 23 | | options.SerializerSettings.Converters.AddPageNewtonsoftSupport(); |
| | 5 | 24 | | }); |
| | | 25 | | |
| | 5 | 26 | | return mvcBuilder; |
| | | 27 | | } |
| | | 28 | | } |