/// <summary>
 /// Returns a new <see cref="CallSettings"/> with the specified retry settings,
 /// merged with the (optional) original settings specified by <paramref name="settings"/>.
 /// </summary>
 /// <param name="settings">Original settings. May be null, in which case the returned settings
 /// will only contain call timing.</param>
 /// <param name="retry">Call timing for the new call settings.
 /// This may be null, in which case any retry settings in <paramref name="settings"/> are
 /// not present in the new call settings. If both this and <paramref name="settings"/> are null,
 /// the return value is null.</param>
 /// <returns>A new set of call settings, or null if both parameters are null.</returns>
 public static CallSettings WithRetry(
     this CallSettings settings,
     RetrySettings retry) =>
 settings == null
         ? CallSettings.FromRetry(retry)
         : new CallSettings(settings.CancellationToken, settings.Credentials,
                            settings.Expiration, retry, settings.HeaderMutation,
                            settings.WriteOptions, settings.PropagationToken,
                            settings.ResponseMetadataHandler, settings.TrailingMetadataHandler);
Ejemplo n.º 2
0
 /// <summary>
 /// Returns a new <see cref="CallSettings"/> with the specified retry settings,
 /// merged with the (optional) original settings specified by <paramref name="settings"/>.
 /// </summary>
 /// <param name="settings">Original settings. May be null, in which case the returned settings
 /// will only contain call timing.</param>
 /// <param name="retry">Call timing for the new call settings.
 /// This may be null, in which case any retry settings in <paramref name="settings"/> are
 /// not present in the new call settings. If both this and <paramref name="settings"/> are null,
 /// the return value is null.</param>
 /// <returns>A new set of call settings, or null if both parameters are null.</returns>
 public static CallSettings WithRetry(
     this CallSettings settings,
     RetrySettings retry) =>
 settings == null
         ? CallSettings.FromRetry(retry)
 // But as long as user code can specify credentials we should continue to respect that.
         : new CallSettings(settings.CancellationToken,
                            settings.Expiration, retry, settings.HeaderMutation,
                            settings.WriteOptions, settings.PropagationToken,
                            settings.ResponseMetadataHandler, settings.TrailingMetadataHandler);