示例#1
0
        /// <summary>
        /// Sets the event stream mediator to handle actions against this data
        /// </summary>
        /// <remarks>
        /// Normally you'd use the constructor to specify this, but in situations where the mediator isn't know at object
        /// creation, this method can be used to set it at a later point.
        /// This isn't a property to avoid it from being serialized to TDDS.
        /// </remarks>
        /// <param name="eventStreamMediator">BAM Mediator</param>
        public virtual void SetEventStreamMediator(IEventStreamMediator eventStreamMediator)
        {
            if (eventStreamMediator == null)
            {
                throw new ArgumentNullException("eventStreamMediator");
            }

            this._eventStream = eventStreamMediator;
        }
示例#2
0
        /// <summary>
        /// Creates a new instance of your activity with the provided event stream underpinning it. One of the other methods might be more useful.
        /// </summary>
        /// <remarks>
        /// Due to the complex dependencies for the OrchestrationEventStream, there isn't a factory method for that, but you can pass a
        /// <see cref="Ox.BizTalk.BAM.OrchestrationEventStreamWrapper"/> into this method.
        /// </remarks>
        /// <typeparam name="TActivity">Your activity</typeparam>
        /// <param name="eventStreamMediator">Desired event stream mediator</param>
        /// <param name="activityId"></param>
        /// <returns>New instance of your activity with id and event stream setup</returns>
        public static TActivity NewActivity <TActivity>(IEventStreamMediator eventStreamMediator, string activityId = null)
            where TActivity : ActivityBase, new()
        {
            CheckActivityId(ref activityId);

            TActivity activity = new TActivity();

            InitialiseActivity(activity, eventStreamMediator, activityId);

            return(activity);
        }
示例#3
0
        /// <summary>
        /// Creates a new instance of your activity with the provided event stream underpinning it. One of the other methods might be more useful.
        /// </summary>
        /// <remarks>
        /// Due to the complex dependencies for the OrchestrationEventStream, there isn't a factory method for that, but you can pass a
        /// <see cref="Ox.BizTalk.BAM.OrchestrationEventStreamWrapper"/> into this method.
        /// </remarks>
        /// <param name="activityType">Your activity</typeparam>
        /// <param name="eventStreamMediator">Desired event stream mediator</param>
        /// <param name="activityId"></param>
        /// <returns>New instance of your activity with id and event stream setup</returns>
        public static object NewActivity(Type activityType, IEventStreamMediator eventStreamMediator, string activityId = null)
        {
            if (!typeof(ActivityBase).IsAssignableFrom(activityType))
            {
                throw new ArgumentException("Supplied type must be derived from ActivityBase.");
            }

            CheckActivityId(ref activityId);

            ActivityBase activity = (ActivityBase)Activator.CreateInstance(activityType);

            InitialiseActivity(activity, eventStreamMediator, activityId);
            return(activity);
        }
 public TestActivity(IEventStreamMediator mediator, string activityId)
     : base(mediator, activityId)
 {
 }
 public TestActivity(IEventStreamMediator mediator)
     : base(mediator)
 {
 }
示例#6
0
 public ActivityBase(IEventStreamMediator eventStreamMediator, string activityId) : this(activityId)
 {
     this.SetEventStreamMediator(eventStreamMediator);
 }
示例#7
0
 public ActivityBase(IEventStreamMediator eventStreamMediator) : this(eventStreamMediator, Guid.NewGuid().ToString())
 {
 }
示例#8
0
 private static void InitialiseActivity(ActivityBase activity, IEventStreamMediator eventStreamMediator, string activityId)
 {
     activity.ActivityId = activityId;
     activity.SetEventStreamMediator(eventStreamMediator);
 }