// One
        public InstanceLockQueryResult(Guid instanceId, Guid instanceOwnerId)
        {
            Dictionary <Guid, Guid> owners = new Dictionary <Guid, Guid>(1);

            owners.Add(instanceId, instanceOwnerId);
            InstanceOwnerIds = new ReadOnlyDictionaryInternal <Guid, Guid>(owners);
        }
Exemple #2
0
            public IDictionary <string, LocationInfo> GetMappedVariables()
            {
                bool resetRequired = false;

                try
                {
                    this.instance.StartReadOnlyOperation(ref resetRequired);

                    this.instance.ValidateGetMappedVariables();

                    IDictionary <string, LocationInfo> mappedLocations = this.instance.executor.GatherMappableVariables();
                    if (mappedLocations != null)
                    {
                        mappedLocations = new ReadOnlyDictionaryInternal <string, LocationInfo>(mappedLocations);
                    }
                    else
                    {
                        mappedLocations = WorkflowInstance.EmptyMappedVariablesDictionary;
                    }
                    return(mappedLocations);
                }
                finally
                {
                    this.instance.FinishOperation(ref resetRequired);
                }
            }
 // Copying the dictionary snapshots it and makes sure the IDictionary implementation is serializable.
 public InstanceLockedException(XName commandName, Guid instanceId, Guid instanceOwnerId, IDictionary<XName, object> serializableInstanceOwnerMetadata, string message, Exception innerException)
     : base(commandName, instanceId, message, innerException)
 {
     InstanceOwnerId = instanceOwnerId;
     if (serializableInstanceOwnerMetadata != null)
     {
         Dictionary<XName, object> copy = new Dictionary<XName, object>(serializableInstanceOwnerMetadata);
         SerializableInstanceOwnerMetadata = new ReadOnlyDictionaryInternal<XName, object>(copy);
     }
 }
 // Copying the dictionary snapshots it and makes sure the IDictionary implementation is serializable.
 public InstanceLockedException(XName commandName, Guid instanceId, Guid instanceOwnerId, IDictionary <XName, object> serializableInstanceOwnerMetadata, string message, Exception innerException)
     : base(commandName, instanceId, message, innerException)
 {
     InstanceOwnerId = instanceOwnerId;
     if (serializableInstanceOwnerMetadata != null)
     {
         Dictionary <XName, object> copy = new Dictionary <XName, object>(serializableInstanceOwnerMetadata);
         SerializableInstanceOwnerMetadata = new ReadOnlyDictionaryInternal <XName, object>(copy);
     }
 }
 // One
 public InstanceOwnerQueryResult(Guid instanceOwnerId, IDictionary<XName, InstanceValue> metadata)
 {
     Dictionary<Guid, IDictionary<XName, InstanceValue>> owners = new Dictionary<Guid, IDictionary<XName, InstanceValue>>(1);
     IDictionary<XName, InstanceValue> safeMetadata; // if metadata is not readonly, copy it.
     if (metadata == null || metadata.IsReadOnly)
         safeMetadata = metadata;
     else
     {
         // Copy dictionary & make a readonly wrapper.
         IDictionary<XName, InstanceValue> copy = new Dictionary<XName, InstanceValue>(metadata);
         safeMetadata = new ReadOnlyDictionaryInternal<XName, InstanceValue>(copy);
     }
     owners.Add(instanceOwnerId, metadata == null ? EmptyMetadata : safeMetadata);
     InstanceOwners = new ReadOnlyDictionaryInternal<Guid, IDictionary<XName, InstanceValue>>(owners);
 }
		public ActivatableWorkflowsQueryResult(IDictionary<XName, object> parameters)
		{
			IDictionary<XName, object> xNames;
			ActivatableWorkflowsQueryResult activatableWorkflowsQueryResult = this;
			List<IDictionary<XName, object>> dictionaries = new List<IDictionary<XName, object>>();
			List<IDictionary<XName, object>> dictionaries1 = dictionaries;
			if (parameters == null)
			{
				xNames = ActivatableWorkflowsQueryResult.emptyDictionary;
			}
			else
			{
				xNames = new ReadOnlyDictionaryInternal<XName, object>(new Dictionary<XName, object>(parameters));
			}
			dictionaries1.Add(xNames);
			activatableWorkflowsQueryResult.ActivationParameters = dictionaries;
		}
        // One
        public InstanceOwnerQueryResult(Guid instanceOwnerId, IDictionary <XName, InstanceValue> metadata)
        {
            Dictionary <Guid, IDictionary <XName, InstanceValue> > owners = new Dictionary <Guid, IDictionary <XName, InstanceValue> >(1);
            IDictionary <XName, InstanceValue> safeMetadata; // if metadata is not readonly, copy it.

            if (metadata == null || metadata.IsReadOnly)
            {
                safeMetadata = metadata;
            }
            else
            {
                // Copy dictionary & make a readonly wrapper.
                IDictionary <XName, InstanceValue> copy = new Dictionary <XName, InstanceValue>(metadata);
                safeMetadata = new ReadOnlyDictionaryInternal <XName, InstanceValue>(copy);
            }
            owners.Add(instanceOwnerId, metadata == null ? EmptyMetadata : safeMetadata);
            InstanceOwners = new ReadOnlyDictionaryInternal <Guid, IDictionary <XName, InstanceValue> >(owners);
        }
 // N
 public InstanceOwnerQueryResult(IDictionary<Guid, IDictionary<XName, InstanceValue>> instanceOwners)
 {
     Dictionary<Guid, IDictionary<XName, InstanceValue>> owners = new Dictionary<Guid, IDictionary<XName, InstanceValue>>(instanceOwners.Count);
     foreach (KeyValuePair<Guid, IDictionary<XName, InstanceValue>> metadata in instanceOwners)
     {
         IDictionary<XName, InstanceValue> safeMetadata; // if metadata is not readonly, copy it.
         if (metadata.Value == null || metadata.Value.IsReadOnly)
             safeMetadata = metadata.Value;
         else
         {
             // Copy dictionary & make a readonly wrapper.
             IDictionary<XName, InstanceValue> copy = new Dictionary<XName, InstanceValue>(metadata.Value);
             safeMetadata = new ReadOnlyDictionaryInternal<XName, InstanceValue>(copy);
         }
         owners.Add(metadata.Key, metadata.Value == null ? EmptyMetadata : safeMetadata);
     }
     InstanceOwners = new ReadOnlyDictionaryInternal<Guid, IDictionary<XName, InstanceValue>>(owners);
 }
        public ActivatableWorkflowsQueryResult(IDictionary <XName, object> parameters)
        {
            IDictionary <XName, object>         xNames;
            ActivatableWorkflowsQueryResult     activatableWorkflowsQueryResult = this;
            List <IDictionary <XName, object> > dictionaries  = new List <IDictionary <XName, object> >();
            List <IDictionary <XName, object> > dictionaries1 = dictionaries;

            if (parameters == null)
            {
                xNames = ActivatableWorkflowsQueryResult.emptyDictionary;
            }
            else
            {
                xNames = new ReadOnlyDictionaryInternal <XName, object>(new Dictionary <XName, object>(parameters));
            }
            dictionaries1.Add(xNames);
            activatableWorkflowsQueryResult.ActivationParameters = dictionaries;
        }
        // N
        public InstanceOwnerQueryResult(IDictionary <Guid, IDictionary <XName, InstanceValue> > instanceOwners)
        {
            Dictionary <Guid, IDictionary <XName, InstanceValue> > owners = new Dictionary <Guid, IDictionary <XName, InstanceValue> >(instanceOwners.Count);

            foreach (KeyValuePair <Guid, IDictionary <XName, InstanceValue> > metadata in instanceOwners)
            {
                IDictionary <XName, InstanceValue> safeMetadata; // if metadata is not readonly, copy it.
                if (metadata.Value == null || metadata.Value.IsReadOnly)
                {
                    safeMetadata = metadata.Value;
                }
                else
                {
                    // Copy dictionary & make a readonly wrapper.
                    IDictionary <XName, InstanceValue> copy = new Dictionary <XName, InstanceValue>(metadata.Value);
                    safeMetadata = new ReadOnlyDictionaryInternal <XName, InstanceValue>(copy);
                }
                owners.Add(metadata.Key, metadata.Value == null ? EmptyMetadata : safeMetadata);
            }
            InstanceOwners = new ReadOnlyDictionaryInternal <Guid, IDictionary <XName, InstanceValue> >(owners);
        }
        // N
        public InstanceLockQueryResult(IDictionary <Guid, Guid> instanceOwnerIds)
        {
            Dictionary <Guid, Guid> copy = new Dictionary <Guid, Guid>(instanceOwnerIds);

            InstanceOwnerIds = new ReadOnlyDictionaryInternal <Guid, Guid>(copy);
        }
		static ActivatableWorkflowsQueryResult()
		{
			ActivatableWorkflowsQueryResult.emptyDictionary = new ReadOnlyDictionaryInternal<XName, object>(new Dictionary<XName, object>(0));
		}
 // N
 public InstanceLockQueryResult(IDictionary<Guid, Guid> instanceOwnerIds)
 {
     Dictionary<Guid, Guid> copy = new Dictionary<Guid, Guid>(instanceOwnerIds);
     InstanceOwnerIds = new ReadOnlyDictionaryInternal<Guid, Guid>(copy);
 }
 // One
 public InstanceLockQueryResult(Guid instanceId, Guid instanceOwnerId)
 {
     Dictionary<Guid, Guid> owners = new Dictionary<Guid, Guid>(1);
     owners.Add(instanceId, instanceOwnerId);
     InstanceOwnerIds = new ReadOnlyDictionaryInternal<Guid, Guid>(owners);
 }
 static ActivatableWorkflowsQueryResult()
 {
     ActivatableWorkflowsQueryResult.emptyDictionary = new ReadOnlyDictionaryInternal <XName, object>(new Dictionary <XName, object>(0));
 }