Example #1
0
 public AquaJsonSerializerSettings(JsonSerializerSettings settings, KnownTypesRegistry?knownTypesRegistry = null)
 {
     settings.CheckNotNull(nameof(settings));
     KnownTypesRegistry = knownTypesRegistry
                          ?? (settings as AquaJsonSerializerSettings)?.KnownTypesRegistry
                          ?? new KnownTypesRegistry();
     Copy(settings);
 }
Example #2
0
        /// <summary>
        /// Sets the <see cref="RemoteLinqContractResolver"/> in <see cref="JsonSerializerSettings"/>,
        /// decorating a previousely set <see cref="IContractResolver"/> if required.
        /// </summary>
        public static JsonSerializerSettings ConfigureRemoteLinq(this JsonSerializerSettings jsonSerializerSettings)
        {
            jsonSerializerSettings = jsonSerializerSettings.CheckNotNull(nameof(jsonSerializerSettings)).ConfigureAqua();

            if (jsonSerializerSettings.ContractResolver?.GetType() != typeof(RemoteLinqContractResolver))
            {
                jsonSerializerSettings.ContractResolver = new RemoteLinqContractResolver(jsonSerializerSettings.ContractResolver);
            }

            return(jsonSerializerSettings);
        }