123456789101112131415161718192021222324252627282930 |
- using System;
- using System.Collections.Generic;
-
- namespace Luticate2.Auth.Utils.Business.Serializers.PartialJson
- {
- internal class LuSerializerContext
- {
- private readonly Func<string, bool> shouldSerialize;
- private readonly Dictionary<string, bool> cache = new Dictionary<string, bool>();
-
- public LuSerializerContext(Func<string, bool> shouldSerialize)
- {
- this.shouldSerialize = shouldSerialize;
- }
-
- public bool ShouldSerialize(string path)
- {
- if (this.cache.ContainsKey(path))
- {
- return this.cache[path];
- }
-
- var result = this.shouldSerialize(path);
-
- this.cache.Add(path, result);
-
- return result;
- }
- }
- }
|