Example #1
0
        public static void RestoreProperties(
            [CanBeNull] string input,
            [NotNull] ContextProperties properties,
            [NotNull] ContextConfiguration configuration)
        {
            foreach (var(name, serializedValue) in ReadProperties(input, configuration.ErrorCallback))
            {
                if (!configuration.DistributedProperties.TryGetValue(name, out var serializer))
                {
                    continue;
                }

                var value = DeserializeValue(name, serializedValue, serializer, configuration.ErrorCallback);
                if (value == null)
                {
                    continue;
                }

                properties.Set(name, value);
            }
        }
Example #2
0
 public static string SerializeProperties(
     [NotNull] ContextProperties properties,
     [NotNull] ContextConfiguration configuration)
 {
     return(SerializeInternal(EnumerateProperties(properties, configuration), configuration.ErrorCallback));
 }