mirror of
https://github.com/collinbarrett/FilterLists.git
synced 2026-03-11 09:04:27 +00:00
support self-reference looping when serializing
per: https://stormpath.com/blog/5-api-tips-dotnet-core#bonus-try-this-workaround-to-improve-serialization-of-self-referencing-object-graphs
This commit is contained in:
parent
86c6a965b2
commit
03e710602a
1 changed files with 12 additions and 7 deletions
|
|
@ -2,6 +2,7 @@
|
|||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.PlatformAbstractions;
|
||||
using Newtonsoft.Json;
|
||||
using Swashbuckle.AspNetCore.Swagger;
|
||||
|
||||
namespace FilterLists.Api.DependencyInjection.Extensions
|
||||
|
|
@ -20,13 +21,17 @@ public static void AddFilterListsApi(this IServiceCollection services)
|
|||
private static void AddMvcCustom(this IServiceCollection services)
|
||||
{
|
||||
services.AddMvc(options =>
|
||||
{
|
||||
options.CacheProfiles.Add("Long-Lived",
|
||||
new CacheProfile
|
||||
{
|
||||
Duration = 86400
|
||||
});
|
||||
});
|
||||
{
|
||||
options.CacheProfiles.Add("Long-Lived",
|
||||
new CacheProfile
|
||||
{
|
||||
Duration = 86400
|
||||
});
|
||||
})
|
||||
.AddJsonOptions(options =>
|
||||
{
|
||||
options.SerializerSettings.ReferenceLoopHandling = ReferenceLoopHandling.Ignore;
|
||||
});
|
||||
}
|
||||
|
||||
private static void AddSwaggerGenCustom(this IServiceCollection services)
|
||||
|
|
|
|||
Loading…
Reference in a new issue