Skip to content

Commit

Permalink
fix(redis): Preserve references in serialisation
Browse files Browse the repository at this point in the history
chore: Linted code for plan-technology-for-your-school.sln solution
  • Loading branch information
jimwashbrook committed Nov 11, 2024
1 parent bf7f57e commit b87d626
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/Dfe.PlanTech.Infrastructure.Redis/JsonSerialiser.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Text.Json;
using System.Text.Json.Serialization;
using System.Text.Json.Serialization.Metadata;
using Dfe.PlanTech.Domain.Content.Models;
using StackExchange.Redis;
Expand All @@ -11,11 +12,14 @@ namespace Dfe.PlanTech.Infrastructure.Redis;
public static class JsonSerialiser
{
/// <summary>
/// Default JSON options to use; adds base class type info resolver from <see cref="ContentComponentJsonExtensions.AddContentComponentPolymorphicInfo"/>
/// Default JSON options to use; adds base class type info resolver from <see cref="ContentComponentJsonExtensions.AddContentComponentPolymorphicInfo"/>
/// </summary>
private static readonly JsonSerializerOptions JsonSerialiserOptions = new()
{
TypeInfoResolver = new DefaultJsonTypeInfoResolver().WithAddedModifier(ContentComponentJsonExtensions.AddContentComponentPolymorphicInfo),
TypeInfoResolver =
new DefaultJsonTypeInfoResolver().WithAddedModifier(ContentComponentJsonExtensions
.AddContentComponentPolymorphicInfo),
ReferenceHandler = ReferenceHandler.Preserve
};

/// <summary>
Expand Down

0 comments on commit b87d626

Please sign in to comment.