Beispiel #1
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.ConfigureAqua();

            jsonSerializerSettings.ContractResolver =
                jsonSerializerSettings.ContractResolver?.GetType() == typeof(DefaultContractResolver)
                    ? new RemoteLinqContractResolver()
                    : new RemoteLinqContractResolver(jsonSerializerSettings.ContractResolver);

            return(jsonSerializerSettings);
        }