AgainstNull() private method

private AgainstNull ( [ argumentName, [ value ) : void
argumentName [
value [
return void
Example #1
0
        /// <summary>
        /// Returns the configured delivery delay by using <see cref="DelayDeliveryWith" />.
        /// </summary>
        /// <param name="options">The options being extended.</param>
        /// <returns>The configured <see cref="TimeSpan" /> or <c>null</c>.</returns>
        public static TimeSpan?GetDeliveryDelay(this SendOptions options)
        {
            Guard.AgainstNull(nameof(options), options);

            return((options.DelayedDeliveryConstraint as DelayDeliveryWith)?.Delay);
        }
Example #2
0
        /// <summary>
        /// Returns the delivery date configured by using <see cref="DoNotDeliverBefore" />.
        /// </summary>
        /// <param name="options">The options being extended.</param>
        /// <returns>The configured <see cref="DateTimeOffset" /> or <c>null</c>.</returns>
        public static DateTimeOffset?GetDeliveryDate(this SendOptions options)
        {
            Guard.AgainstNull(nameof(options), options);

            return((options.DelayedDeliveryConstraint as DoNotDeliverBefore)?.At);
        }
        /// <summary>
        /// Publish the message to subscribers.
        /// </summary>
        /// <param name="context">The instance of <see cref="IPipelineContext" /> to use for the action.</param>
        /// <typeparam name="T">The message type.</typeparam>
        public static Task Publish<T>(this IPipelineContext context)
        {
            Guard.AgainstNull(nameof(context), context);

            return context.Publish<T>(_ => { }, new PublishOptions());
        }
Example #4
0
 /// <summary>
 /// Populates a <see cref="SerializationInfo" /> with the data needed to serialize the target object.
 /// </summary>
 /// <param name="info">The <see cref="SerializationInfo" /> to populate with data. </param>
 /// <param name="context">The destination (see <see cref="StreamingContext" />) for this serialization. </param>
 /// <exception cref="T:System.Security.SecurityException">The caller does not have the required permission. </exception>
 public void GetObjectData(SerializationInfo info, StreamingContext context)
 {
     Guard.AgainstNull(nameof(info), info);
     info.AddValue("Key", Key);
     info.AddValue("HasValue", HasValue);
 }
Example #5
0
 /// <summary>
 /// For serialization purposes.
 /// </summary>
 /// <param name="info">The <see cref="SerializationInfo" /> to populate with data. </param>
 /// <param name="context">The destination (see <see cref="StreamingContext" />) for this serialization. </param>
 /// <exception cref="SecurityException">The caller does not have the required permission. </exception>
 protected DataBusProperty(SerializationInfo info, StreamingContext context)
 {
     Guard.AgainstNull(nameof(info), info);
     Key      = info.GetString("Key");
     HasValue = info.GetBoolean("HasValue");
 }
Example #6
0
        /// <summary>
        /// Creates a new startable endpoint based on the provided configuration.
        /// </summary>
        /// <param name="configuration">Configuration.</param>
        public static Task<IStartableEndpoint> Create(EndpointConfiguration configuration)
        {
            Guard.AgainstNull(nameof(configuration), configuration);

            return HostCreator.CreateWithInternallyManagedContainer(configuration);
        }
        /// <summary>
        /// Set a retry policy that returns a TimeSpan to delay between attempts based on the number of retries attempted. Return
        /// <see cref="TimeSpan.Zero" /> to abort retries.
        /// </summary>
        /// <param name="customRetryPolicy">The custom retry policy to use.</param>
        public void CustomRetryPolicy(Func <IncomingMessage, Exception, int, TimeSpan> customRetryPolicy)
        {
            Guard.AgainstNull(nameof(customRetryPolicy), customRetryPolicy);

            settings.Set("Gateway.Retries.RetryPolicy", customRetryPolicy);
        }