Beispiel #1
0
 internal ExecutionProperties(ActivityContext currentContext, System.Activities.ActivityInstance scope, ExecutionPropertyManager properties)
 {
     this.context    = currentContext;
     this.scope      = scope;
     this.properties = properties;
     if (this.context != null)
     {
         this.currentIdSpace = this.context.Activity.MemberOf;
     }
 }
Beispiel #2
0
        internal ExecutionProperties(ActivityContext currentContext, ActivityInstance scope, ExecutionPropertyManager properties)
        {
            _context    = currentContext;
            _scope      = scope;
            _properties = properties;

            if (_context != null)
            {
                _currentIdSpace = _context.Activity.MemberOf;
            }
        }
        internal void Add(string name, object property, bool skipValidations, bool onlyVisibleToPublicChildren)
        {
            if (!skipValidations)
            {
                if (string.IsNullOrEmpty(name))
                {
                    throw FxTrace.Exception.ArgumentNullOrEmpty("name");
                }

                if (property == null)
                {
                    throw FxTrace.Exception.ArgumentNull("property");
                }

                ThrowIfActivityExecutionContextDisposed();
                ThrowIfChildrenAreExecuting();
            }

            if (this.properties != null)
            {
                this.properties.ThrowIfAlreadyDefined(name, this.scope);
            }

            IPropertyRegistrationCallback registrationCallback = property as IPropertyRegistrationCallback;

            if (registrationCallback != null)
            {
                registrationCallback.Register(new RegistrationContext(this.properties, this.currentIdSpace));
            }

            if (this.properties == null)
            {
                this.properties = new ExecutionPropertyManager(this.scope);
            }
            else if (!this.properties.IsOwner(this.scope))
            {
                //
                this.properties = new ExecutionPropertyManager(this.scope, this.properties);
            }

            IdSpace visibility = null;

            if (onlyVisibleToPublicChildren)
            {
                Fx.Assert(this.currentIdSpace != null, "We should never call OnlyVisibleToPublicChildren when we don't have a currentIdSpace");
                visibility = this.currentIdSpace;
            }

            this.properties.Add(name, property, visibility);
        }
Beispiel #4
0
        internal void Add(string name, object property, bool skipValidations, bool onlyVisibleToPublicChildren)
        {
            if (!skipValidations)
            {
                if (string.IsNullOrEmpty(name))
                {
                    throw FxTrace.Exception.ArgumentNullOrEmpty(nameof(name));
                }

                if (property == null)
                {
                    throw FxTrace.Exception.ArgumentNull(nameof(property));
                }

                ThrowIfActivityExecutionContextDisposed();
                ThrowIfChildrenAreExecuting();
            }

            if (this.properties != null)
            {
                this.properties.ThrowIfAlreadyDefined(name, this.scope);
            }


            if (property is IPropertyRegistrationCallback registrationCallback)
            {
                registrationCallback.Register(new RegistrationContext(this.properties, this.currentIdSpace));
            }

            if (this.properties == null)
            {
                this.properties = new ExecutionPropertyManager(this.scope);
            }
            else if (!this.properties.IsOwner(this.scope))
            {
                // TODO, 51474, Thread properties are broken when the this.scope is not the current activity.  This will only happen for NoPersistProperty right now so it doesn't matter.
                this.properties = new ExecutionPropertyManager(this.scope, this.properties);
            }

            IdSpace visibility = null;

            if (onlyVisibleToPublicChildren)
            {
                Fx.Assert(this.currentIdSpace != null, "We should never call OnlyVisibleToPublicChildren when we don't have a currentIdSpace");
                visibility = this.currentIdSpace;
            }

            this.properties.Add(name, property, visibility);
        }
Beispiel #5
0
 internal RegistrationContext(ExecutionPropertyManager properties, IdSpace currentIdSpace)
 {
     _properties     = properties;
     _currentIdSpace = currentIdSpace;
 }
 internal RegistrationContext(ExecutionPropertyManager properties, IdSpace currentIdSpace)
 {
     this.properties = properties;
     this.currentIdSpace = currentIdSpace;
 }