/// <summary> Adds a WorkflowRuntimeServiceSettings object to this collection </summary>
        /// <param name="settings"> The settings object to add </param>
        public void Add(WorkflowRuntimeServiceElement serviceSettings)
        {
            if (serviceSettings == null)
                throw new ArgumentNullException("serviceSettings");

            base.BaseAdd(serviceSettings);
        }
 public void Add(WorkflowRuntimeServiceElement serviceSettings)
 {
     if (serviceSettings == null)
     {
         throw new ArgumentNullException("serviceSettings");
     }
     base.BaseAdd(serviceSettings);
 }
Example #3
0
 public WorkflowRuntimeServiceElement this [object key] {
     get { return((WorkflowRuntimeServiceElement)BaseGet(key)); }
     set {
         WorkflowRuntimeServiceElement el = (WorkflowRuntimeServiceElement)BaseGet(key);
         if (el == null)
         {
             BaseAdd(value);
             return;
         }
         int index = IndexOf(el);
         BaseRemoveAt(index);
         BaseAdd(index, value);
     }
 }
        // Todo: This is duplicate of code in WorkflowRuntime
        internal object ServiceFromSettings(WorkflowRuntimeServiceElement serviceSettings)
        {
            object service = null;

            Type t = Type.GetType(serviceSettings.Type, true);

            ConstructorInfo serviceProviderAndSettingsConstructor = null;
            ConstructorInfo serviceProviderConstructor = null;
            ConstructorInfo settingsConstructor = null;

            foreach (ConstructorInfo ci in t.GetConstructors())
            {
                ParameterInfo[] pi = ci.GetParameters();
                if (pi.Length == 1)
                {
                    if (typeof(IServiceProvider).IsAssignableFrom(pi[0].ParameterType))
                    {
                        serviceProviderConstructor = ci;
                    }
                    else if (typeof(NameValueCollection).IsAssignableFrom(pi[0].ParameterType))
                    {
                        settingsConstructor = ci;
                    }
                }
                else if (pi.Length == 2)
                {
                    if (typeof(IServiceProvider).IsAssignableFrom(pi[0].ParameterType)
                        && typeof(NameValueCollection).IsAssignableFrom(pi[1].ParameterType))
                    {
                        serviceProviderAndSettingsConstructor = ci;
                        break;
                    }
                }
            }

            if (serviceProviderAndSettingsConstructor != null)
            {
                service = serviceProviderAndSettingsConstructor.Invoke(
                    new object[] { Runtime, serviceSettings.Parameters });
            }
            else if (serviceProviderConstructor != null)
            {
                service = serviceProviderConstructor.Invoke(new object[] { Runtime });
            }
            else if (settingsConstructor != null)
            {
                service = settingsConstructor.Invoke(new object[] { serviceSettings.Parameters });
            }
            else
            {
                service = Activator.CreateInstance(t);
            }
            return service;
        }
 public void Remove(WorkflowRuntimeServiceElement serviceSettings)
 {
     base.BaseRemove(base.GetElementKey(serviceSettings));
 }
 internal object ServiceFromSettings(WorkflowRuntimeServiceElement serviceSettings)
 {
     Type type = Type.GetType(serviceSettings.Type, true);
     ConstructorInfo info = null;
     ConstructorInfo info2 = null;
     ConstructorInfo info3 = null;
     foreach (ConstructorInfo info4 in type.GetConstructors())
     {
         ParameterInfo[] parameters = info4.GetParameters();
         if (parameters.Length == 1)
         {
             if (typeof(IServiceProvider).IsAssignableFrom(parameters[0].ParameterType))
             {
                 info2 = info4;
             }
             else if (typeof(NameValueCollection).IsAssignableFrom(parameters[0].ParameterType))
             {
                 info3 = info4;
             }
         }
         else if (((parameters.Length == 2) && typeof(IServiceProvider).IsAssignableFrom(parameters[0].ParameterType)) && typeof(NameValueCollection).IsAssignableFrom(parameters[1].ParameterType))
         {
             info = info4;
             break;
         }
     }
     if (info != null)
     {
         return info.Invoke(new object[] { base.Runtime, serviceSettings.Parameters });
     }
     if (info2 != null)
     {
         return info2.Invoke(new object[] { base.Runtime });
     }
     if (info3 != null)
     {
         return info3.Invoke(new object[] { serviceSettings.Parameters });
     }
     return Activator.CreateInstance(type);
 }
Example #7
0
        public void Defaults()
        {
            WorkflowRuntimeServiceElement s = new WorkflowRuntimeServiceElement();

            Assert.AreEqual("", s.Type, "A1");
        }
		public void Remove (WorkflowRuntimeServiceElement element)
		{
			BaseRemove (element.Type);
		}
		public int IndexOf (WorkflowRuntimeServiceElement element)
		{
			return BaseIndexOf (element);
		}
		public void CopyTo (WorkflowRuntimeServiceElement[] array, int index)
		{
			((ICollection)this).CopyTo (array, index);
		}
		public void Add (WorkflowRuntimeServiceElement element)
		{
			BaseAdd (element);
		}
		public void Defaults ()
		{
			WorkflowRuntimeServiceElement s = new WorkflowRuntimeServiceElement ();
			Assert.AreEqual ("", s.Type, "A1");
		}
Example #13
0
 public void Remove(WorkflowRuntimeServiceElement element)
 {
     BaseRemove(element.Type);
 }
Example #14
0
 public int IndexOf(WorkflowRuntimeServiceElement element)
 {
     return(BaseIndexOf(element));
 }
Example #15
0
 public void Add(WorkflowRuntimeServiceElement element)
 {
     BaseAdd(element);
 }