private void ProcessChildrenForExclusiveHandles(HybridCollection <ActivityInstance> children, int amountToUpdate, ref Queue <HybridCollection <ActivityInstance> > toProcess) { for (int i = 0; i < children.Count; i++) { ActivityInstance child = children[i]; ExecutionPropertyManager childManager = child.PropertyManager; if (childManager.IsOwner(child)) { childManager._exclusiveHandleCount += amountToUpdate; } HybridCollection <ActivityInstance> tempChildren = child.GetRawChildren(); if (tempChildren != null && tempChildren.Count > 0) { if (toProcess == null) { toProcess = new Queue <HybridCollection <ActivityInstance> >(); } toProcess.Enqueue(tempChildren); } } }
public void OnDeserialized(ActivityInstance owner, ActivityInstance parent, IdSpace visibility, ActivityExecutor executor) { _owningInstance = owner; if (parent != null) { if (parent.PropertyManager != null) { _threadProperties = parent.PropertyManager._threadProperties; } } else { _rootPropertyManager = executor.RootPropertyManager; } foreach (ExecutionProperty property in _properties.Values) { if (property.Property is IExecutionProperty) { AddIExecutionProperty(property, true); } if (property.HasRestrictedVisibility) { property.Visibility = visibility; } } }
public object GetProperty(string name, IdSpace currentIdSpace) { Fx.Assert(!string.IsNullOrEmpty(name), "The name should be validated by the caller."); if (_lastPropertyName == name && (_lastPropertyVisibility == null || _lastPropertyVisibility == currentIdSpace)) { return(_lastProperty); } ExecutionPropertyManager currentManager = this; while (currentManager != null) { ExecutionProperty property; if (currentManager._properties.TryGetValue(name, out property)) { if (!property.IsRemoved && (!property.HasRestrictedVisibility || property.Visibility == currentIdSpace)) { _lastPropertyName = name; _lastProperty = property.Property; _lastPropertyVisibility = property.Visibility; return(_lastProperty); } } currentManager = GetParent(currentManager); } return(null); }
internal ExecutionPropertyManager(ActivityInstance owningInstance, Dictionary <string, ExecutionProperty> properties) { Fx.Assert(properties != null, "properties should never be null"); _owningInstance = owningInstance; _properties = properties; // owningInstance can be null (for host-provided root properties) if (owningInstance == null) { _rootPropertyManager = this; } }
public ExecutionPropertyManager(ActivityInstance owningInstance, ExecutionPropertyManager parentPropertyManager) : this(owningInstance) { Fx.Assert(parentPropertyManager != null, "caller must verify"); _threadProperties = parentPropertyManager._threadProperties; // if our parent is null, capture any root properties if (owningInstance.Parent == null) { _rootPropertyManager = parentPropertyManager._rootPropertyManager; } }
public IEnumerable <KeyValuePair <string, object> > GetFlattenedProperties(IdSpace currentIdSpace) { ExecutionPropertyManager currentManager = this; Dictionary <string, object> flattenedProperties = new Dictionary <string, object>(); while (currentManager != null) { AddProperties(currentManager.Properties, flattenedProperties, currentIdSpace); currentManager = GetParent(currentManager); } return(flattenedProperties); }
private static ExecutionPropertyManager GetParent(ExecutionPropertyManager currentManager) { if (currentManager._owningInstance != null) { if (currentManager._owningInstance.Parent != null) { return(currentManager._owningInstance.Parent.PropertyManager); } else { return(currentManager._rootPropertyManager); } } else { return(null); } }
//Currently this is only used for the exclusive scope processing internal List <T> FindAll <T>() where T : class { ExecutionPropertyManager currentManager = this; List <T> list = null; while (currentManager != null) { foreach (ExecutionProperty property in currentManager.Properties.Values) { if (property.Property is T) { if (list == null) { list = new List <T>(); } list.Add((T)property.Property); } } currentManager = GetParent(currentManager); } return(list); }