private static void InternalFilterProperties(IServiceProvider serviceProvider, object propertyOwner, IDictionary properties)
        {
            // change property descriptors
            Hashtable newProperties = new Hashtable();

            foreach (object key in properties.Keys)
            {
                PropertyDescriptor propDesc = properties[key] as PropertyDescriptor;
                if (string.Equals(propDesc.Name, "Name", StringComparison.Ordinal) && typeof(Activity).IsAssignableFrom(propDesc.ComponentType))
                {
                    //Activity id
                    Activity activity = propertyOwner as Activity;
                    if (activity != null && activity == Helpers.GetRootActivity(activity))
                    {
                        newProperties[key] = new NamePropertyDescriptor(serviceProvider, propDesc);
                    }
                    else
                    {
                        newProperties[key] = new IDPropertyDescriptor(serviceProvider, propDesc);
                    }
                }
                else if (!(propDesc is ActivityBindPropertyDescriptor) && ActivityBindPropertyDescriptor.IsBindableProperty(propDesc))
                {
                    if (typeof(Type).IsAssignableFrom(propDesc.PropertyType) && !(propDesc is ParameterInfoBasedPropertyDescriptor))
                    {
                        propDesc = new TypePropertyDescriptor(serviceProvider, propDesc);
                    }
                    newProperties[key] = new ActivityBindPropertyDescriptor(serviceProvider, propDesc, propertyOwner);
                }
                else if (typeof(Type).IsAssignableFrom(propDesc.PropertyType))
                {
                    newProperties[key] = new TypePropertyDescriptor(serviceProvider, propDesc);
                }
                else
                {
                    newProperties[key] = new DynamicPropertyDescriptor(serviceProvider, propDesc);
                }
            }

            foreach (object key in newProperties.Keys)
            {
                properties[key] = newProperties[key];
            }
        }
Example #2
0
        private static void InternalFilterProperties(IServiceProvider serviceProvider, object propertyOwner, IDictionary properties)
        {
            Hashtable hashtable = new Hashtable();

            foreach (object obj2 in properties.Keys)
            {
                PropertyDescriptor actualPropDesc = properties[obj2] as PropertyDescriptor;
                if (string.Equals(actualPropDesc.Name, "Name", StringComparison.Ordinal) && typeof(Activity).IsAssignableFrom(actualPropDesc.ComponentType))
                {
                    Activity activity = propertyOwner as Activity;
                    if ((activity != null) && (activity == Helpers.GetRootActivity(activity)))
                    {
                        hashtable[obj2] = new NamePropertyDescriptor(serviceProvider, actualPropDesc);
                    }
                    else
                    {
                        hashtable[obj2] = new IDPropertyDescriptor(serviceProvider, actualPropDesc);
                    }
                }
                else if (!(actualPropDesc is ActivityBindPropertyDescriptor) && ActivityBindPropertyDescriptor.IsBindableProperty(actualPropDesc))
                {
                    if (typeof(Type).IsAssignableFrom(actualPropDesc.PropertyType) && !(actualPropDesc is ParameterInfoBasedPropertyDescriptor))
                    {
                        actualPropDesc = new TypePropertyDescriptor(serviceProvider, actualPropDesc);
                    }
                    hashtable[obj2] = new ActivityBindPropertyDescriptor(serviceProvider, actualPropDesc, propertyOwner);
                }
                else if (typeof(Type).IsAssignableFrom(actualPropDesc.PropertyType))
                {
                    hashtable[obj2] = new TypePropertyDescriptor(serviceProvider, actualPropDesc);
                }
                else
                {
                    hashtable[obj2] = new DynamicPropertyDescriptor(serviceProvider, actualPropDesc);
                }
            }
            foreach (object obj3 in hashtable.Keys)
            {
                properties[obj3] = hashtable[obj3];
            }
        }
 private static void InternalFilterProperties(IServiceProvider serviceProvider, object propertyOwner, IDictionary properties)
 {
     Hashtable hashtable = new Hashtable();
     foreach (object obj2 in properties.Keys)
     {
         PropertyDescriptor actualPropDesc = properties[obj2] as PropertyDescriptor;
         if (string.Equals(actualPropDesc.Name, "Name", StringComparison.Ordinal) && typeof(Activity).IsAssignableFrom(actualPropDesc.ComponentType))
         {
             Activity activity = propertyOwner as Activity;
             if ((activity != null) && (activity == Helpers.GetRootActivity(activity)))
             {
                 hashtable[obj2] = new NamePropertyDescriptor(serviceProvider, actualPropDesc);
             }
             else
             {
                 hashtable[obj2] = new IDPropertyDescriptor(serviceProvider, actualPropDesc);
             }
         }
         else if (!(actualPropDesc is ActivityBindPropertyDescriptor) && ActivityBindPropertyDescriptor.IsBindableProperty(actualPropDesc))
         {
             if (typeof(Type).IsAssignableFrom(actualPropDesc.PropertyType) && !(actualPropDesc is ParameterInfoBasedPropertyDescriptor))
             {
                 actualPropDesc = new TypePropertyDescriptor(serviceProvider, actualPropDesc);
             }
             hashtable[obj2] = new ActivityBindPropertyDescriptor(serviceProvider, actualPropDesc, propertyOwner);
         }
         else if (typeof(Type).IsAssignableFrom(actualPropDesc.PropertyType))
         {
             hashtable[obj2] = new TypePropertyDescriptor(serviceProvider, actualPropDesc);
         }
         else
         {
             hashtable[obj2] = new DynamicPropertyDescriptor(serviceProvider, actualPropDesc);
         }
     }
     foreach (object obj3 in hashtable.Keys)
     {
         properties[obj3] = hashtable[obj3];
     }
 }
        private static void InternalFilterProperties(IServiceProvider serviceProvider, object propertyOwner, IDictionary properties)
        {
            // change property descriptors
            Hashtable newProperties = new Hashtable();
            foreach (object key in properties.Keys)
            {
                PropertyDescriptor propDesc = properties[key] as PropertyDescriptor;
                if (string.Equals(propDesc.Name, "Name", StringComparison.Ordinal) && typeof(Activity).IsAssignableFrom(propDesc.ComponentType))
                {
                    //Activity id
                    Activity activity = propertyOwner as Activity;
                    if (activity != null && activity == Helpers.GetRootActivity(activity))
                        newProperties[key] = new NamePropertyDescriptor(serviceProvider, propDesc);
                    else
                        newProperties[key] = new IDPropertyDescriptor(serviceProvider, propDesc);
                }
                else if (!(propDesc is ActivityBindPropertyDescriptor) && ActivityBindPropertyDescriptor.IsBindableProperty(propDesc))
                {
                    if (typeof(Type).IsAssignableFrom(propDesc.PropertyType) && !(propDesc is ParameterInfoBasedPropertyDescriptor))
                        propDesc = new TypePropertyDescriptor(serviceProvider, propDesc);
                    newProperties[key] = new ActivityBindPropertyDescriptor(serviceProvider, propDesc, propertyOwner);
                }
                else if (typeof(Type).IsAssignableFrom(propDesc.PropertyType))
                {
                    newProperties[key] = new TypePropertyDescriptor(serviceProvider, propDesc);
                }
                else
                {
                    newProperties[key] = new DynamicPropertyDescriptor(serviceProvider, propDesc);
                }
            }

            foreach (object key in newProperties.Keys)
            {
                properties[key] = newProperties[key];
            }
        }