public ComponentInfo GetComponentInfo(Type type)
        {
            if (type == null)
            {
                throw new ArgumentNullException("type");
            }

            if (componentInfoCache.Contains(type))
            {
                return(componentInfoCache[type]);
            }

            var typeHandler   = GetTypeHandler(type);
            var componentInfo = new ComponentInfo(type, typeHandler);

            componentInfoCache.Add(componentInfo);
            return(componentInfo);
        }
Esempio n. 2
0
        void PopulateProperty(ComponentInfo componentInfo, object component, ref PropertyDefinition propertyDefinition)
        {
            var propertyName = propertyDefinition.Name;

            if (string.IsNullOrEmpty(propertyName))
            {
                return;
            }

            var property      = componentInfo.GetProperty(propertyName);
            var propertyValue = propertyDefinition.Value;

            for (int i = 0; i < PropertyHandlers.Count; i++)
            {
                var handler = PropertyHandlers[i];
                if (handler.SetPropertyValue(component, property, propertyValue))
                {
                    return;
                }
            }

            throw new InvalidOperationException("Property not handled: " + propertyName);
        }
Esempio n. 3
0
        void PopulateProperty(ComponentInfo componentInfo, object component, ref PropertyDefinition propertyDefinition)
        {
            var propertyName = propertyDefinition.Name;
            if (string.IsNullOrEmpty(propertyName)) return;

            var property = componentInfo.GetProperty(propertyName);
            var propertyValue = propertyDefinition.Value;

            for (int i = 0; i < PropertyHandlers.Count; i++)
            {
                var handler = PropertyHandlers[i];
                if (handler.SetPropertyValue(component, property, propertyValue))
                    return;
            }

            throw new InvalidOperationException("Property not handled: " + propertyName);
        }
 public string GetTypeDefinitionName(ComponentInfo componentInfo)
 {
     return(typeRegistory.GetTypeDefinitionName(componentInfo.ComponentType));
 }