Esempio n. 1
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);
        }
Esempio n. 2
0
 private static void InitialiseActivity(ActivityBase activity, IEventStreamMediator eventStreamMediator, string activityId)
 {
     activity.ActivityId = activityId;
     activity.SetEventStreamMediator(eventStreamMediator);
 }