Exemple #1
0
        public BuildTagsOp <TEvent> DeepCloneWithEvent(TEvent @event)
        {
            var result = new BuildTagsOp <TEvent>(
                this.TrackingCodeId.DeepClone(),
                @event,
                this.InheritableTags?.DeepClone());

            return(result);
        }
        /// <inheritdoc />
        public override IReadOnlyCollection <NamedValue <string> > Execute(
            BuildTagsOp <TEvent> operation)
        {
            new { operation }.AsArg().Must().NotBeNull();

            var result = operation.InheritableTags;

            return(result);
        }
        /// <inheritdoc />
        public override IReadOnlyCollection <NamedValue <string> > Execute(
            BuildTagsOp <TEvent> operation)
        {
            new { operation }.AsArg().Must().NotBeNull();

            var result = (operation.InheritableTags?.DeepClone() ?? new List <NamedValue <string> >()).ToList();

            var tagsToAdd = this.getTagsToAdd(operation.Event);

            foreach (var tagToAdd in tagsToAdd)
            {
                result.Add(new NamedValue <string>(tagToAdd.Name, tagToAdd.Value));
            }

            return(result);
        }
Exemple #4
0
        /// <inheritdoc />
        public bool Equals(BuildTagsOp <TEvent> other)
        {
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            if (ReferenceEquals(other, null))
            {
                return(false);
            }

            var result = this.TrackingCodeId.IsEqualTo(other.TrackingCodeId) &&
                         this.Event.IsEqualTo(other.Event) &&
                         this.InheritableTags.IsEqualTo(other.InheritableTags);

            return(result);
        }
        /// <summary>
        /// Executes an <see cref="IBuildTagsProtocol{TEvent}"/> protocol.
        /// </summary>
        /// <remarks>
        /// This is a convenience method to build a <see cref="BuildTagsOp{TEvent}"/>
        /// and execute it against the specified protocol.
        /// </remarks>
        /// <typeparam name="TEvent">The type of event to build the tags for.</typeparam>
        /// <param name="protocol">The protocol to execute.</param>
        /// <param name="trackingCodeId">The tracking code identifier (in-context of the protocol putting the event).</param>
        /// <param name="event">The event that will be put.</param>
        /// <param name="inheritableTags">OPTIONAL tags that can be inherited from a prior step in the workflow.  DEFAULT is null, indicating that there was no prior step or that no tags have been established in the workflow.</param>
        /// <returns>
        /// The tags to use when putting the specified event into a stream.
        /// </returns>
        public static IReadOnlyCollection <NamedValue <string> > ExecuteBuildTags <TEvent>(
            this ISyncReturningProtocol <BuildTagsOp <TEvent>, IReadOnlyCollection <NamedValue <string> > > protocol,
            long trackingCodeId,
            TEvent @event,
            IReadOnlyCollection <NamedValue <string> > inheritableTags = null)
            where TEvent : IEvent
        {
            IReadOnlyCollection <NamedValue <string> > result = null;

            if (protocol != null)
            {
                var buildTagsOperation = new BuildTagsOp <TEvent>(trackingCodeId, @event, inheritableTags);

                result = protocol.Execute(buildTagsOperation);
            }

            return(result);
        }