Base class for delivery constraints.
        /// <summary>
        /// Removes a <see cref="DeliveryConstraint" /> to a <see cref="ContextBag" />.
        /// </summary>
        public static void RemoveDeliveryConstaint(this ContextBag context, DeliveryConstraint constraint)
        {
            List <DeliveryConstraint> constraints;

            if (!context.TryGet(out constraints))
            {
                return;
            }

            constraints.Remove(constraint);
        }
Esempio n. 2
0
        /// <summary>
        /// Removes a <see cref="DeliveryConstraint"/> to a <see cref="IRoutingContext"/>.
        /// </summary>
        public static void RemoveDeliveryConstaint(this IRoutingContext context, DeliveryConstraint constraint)
        {
            List <DeliveryConstraint> constraints;

            if (!context.Extensions.TryGet(out constraints))
            {
                return;
            }

            constraints.Remove(constraint);
        }
        /// <summary>
        /// Removes a <see cref="DeliveryConstraint" /> from a <see cref="ContextBag" />.
        /// </summary>
        public static void RemoveDeliveryConstraint(this ContextBag context, DeliveryConstraint constraint)
        {
            Guard.AgainstNull(nameof(constraint), constraint);
            Guard.AgainstNull(nameof(context), context);

            if (!context.TryGet(out List <DeliveryConstraint> constraints))
            {
                return;
            }

            constraints.Remove(constraint);
        }
        /// <summary>
        /// Adds a <see cref="DeliveryConstraint" /> to a <see cref="ContextBag" />.
        /// </summary>
        public static void AddDeliveryConstraint(this ContextBag context, DeliveryConstraint constraint)
        {
            List <DeliveryConstraint> constraints;

            if (!context.TryGet(out constraints))
            {
                constraints = new List <DeliveryConstraint>();

                context.Set(constraints);
            }

            if (constraints.Any(c => c.GetType() == constraint.GetType()))
            {
                throw new InvalidOperationException("Constraint of type " + constraint.GetType().FullName + " already exists");
            }

            constraints.Add(constraint);
        }
Esempio n. 5
0
        static void AddDeliveryConstraintInternal(IBehaviorContext context, DeliveryConstraint constraint)
        {
            List <DeliveryConstraint> constraints;

            if (!context.Extensions.TryGet(out constraints))
            {
                constraints = new List <DeliveryConstraint>();

                context.Extensions.Set(constraints);
            }

            if (constraints.Any(c => c.GetType() == constraint.GetType()))
            {
                throw new InvalidOperationException("Constraint of type " + constraint.GetType().FullName + " already exists");
            }

            constraints.Add(constraint);
        }
Esempio n. 6
0
 public static void RemoveDeliveryConstaint(this ContextBag context, DeliveryConstraint constraint)
 {
     throw new NotImplementedException();
 }
Esempio n. 7
0
 /// <summary>
 /// Adds a <see cref="DeliveryConstraint"/> to a <see cref="IOutgoingLogicalMessageContext"/>.
 /// </summary>
 public static void AddDeliveryConstraint(this IOutgoingLogicalMessageContext context, DeliveryConstraint constraint)
 {
     AddDeliveryConstraintInternal(context, constraint);
 }
Esempio n. 8
0
 /// <summary>
 /// Adds a <see cref="DeliveryConstraint"/> to a <see cref="IRoutingContext"/>.
 /// </summary>
 public static void AddDeliveryConstraint(this IRoutingContext context, DeliveryConstraint constraint)
 {
     AddDeliveryConstraintInternal(context, constraint);
 }