Exemple #1
0
        protected override Task <object> ExecuteContainerActivity(NativeActivityContext context, CancellationToken token)
        {
            // If ScopeExampleApplication is set use the provided value else create an ExampleApplication object.
            IExampleApplication application = ScopeExampleApplication.Get(context) ?? new ExampleApplication();

            return(Task.Factory.StartNew(() =>
            {
                application.Option = ExamplePropertyOptions.Option1;

                return (object)application;
            }, token));
        }
Exemple #2
0
        /// <summary>
        ///     Executes the Activity, gets the context object from the scope and sets the value into Option argument.
        /// </summary>
        /// <param name="context">The execution context of the activity.</param>
        protected override void ExecuteActivity(CodeActivityContext context)
        {
            // Get the ExampleApplication that has been set in the scope activity from the current context.
            IExampleApplication exampleApplication =
                context.DataContext.GetProperties()[ScopeActivity.ScopeContextItemName].GetValue(context.DataContext) as
                IExampleApplication;

            if (exampleApplication != null)
            {
                Option.Set(context, exampleApplication.Option.ToString());
            }
        }
 public SampleController(IExampleApplication ExampleApplication
                         , IMapper mapper)
 {
     _exampleApplication = ExampleApplication;
     _mapper             = mapper;
 }