示例#1
0
        protected IEnumerable <PropertyBase> GetProperties()
        {
            IPropertyFinder propertyFinder = _metadataFactory.CreatePropertyFinder(_concreteType);

            Dictionary <string, PropertyBase> propertiesByName = new Dictionary <string, PropertyBase>();

            foreach (IPropertyInformation propertyInfo in propertyFinder.GetPropertyInfos())
            {
                PropertyReflector propertyReflector = _metadataFactory.CreatePropertyReflector(_concreteType, propertyInfo, _businessObjectProvider);
                PropertyBase      property          = propertyReflector.GetMetadata();
                if (propertiesByName.ContainsKey(property.Identifier))
                {
                    string message = string.Format(
                        "Type '{0}' has two properties called '{1}', this is currently not supported.",
                        TargetType.FullName,
                        property.Identifier);
                    throw new NotSupportedException(message);
                }
                else
                {
                    propertiesByName.Add(property.Identifier, property);
                }
            }

            return(propertiesByName.Values);
        }