コード例 #1
0
        private static PropertySheet GetPropSheetInstanceFromClass(Type targetClass, Dictionary <String, Object> defaultProps, string componentName, ConfigurationManager cm)
        {
            var rpd = new RawPropertyData(componentName, targetClass.Name);

            foreach (var entry in defaultProps)
            {
                var property = entry.Value;

                if (property.GetType().IsInstanceOfType(targetClass))//Todo: check behaviour. Note changing this results in UnitTest fails for Scorer.
                {
                    property = property.GetType().Name;
                }

                rpd.GetProperties().Add(entry.Key, property);
            }

            return(new PropertySheet(targetClass, componentName, cm, rpd));
        }
コード例 #2
0
        public PropertySheet(Type confClass, string name, ConfigurationManager cm, RawPropertyData rpd)
        {
            _ownerClass   = confClass;
            _cm           = cm;
            _instanceName = name;

            ParseClass(confClass);
            SetConfigurableClass(confClass);

            // now apply all xml properties
            var flatProps = rpd.Flatten(cm).GetProperties();

            _rawProps = new HashMap <string, Object>(rpd.GetProperties());

            foreach (var propName in _rawProps.Keys)
            {
                _propValues.Put(propName, flatProps.Get(propName));
            }
        }