Ejemplo n.º 1
0
 internal IEnumerable <ValidationAttribute> GetPropertyValidationAttributes(ValidationContext validationContext)
 {
     ValidationAttributeStore.EnsureValidationContext(validationContext);
     ValidationAttributeStore.TypeStoreItem     typeStoreItem     = this.GetTypeStoreItem(validationContext.ObjectType);
     ValidationAttributeStore.PropertyStoreItem propertyStoreItem = typeStoreItem.GetPropertyStoreItem(validationContext.MemberName);
     return(propertyStoreItem.ValidationAttributes);
 }
Ejemplo n.º 2
0
 internal Type GetPropertyType(ValidationContext validationContext)
 {
     ValidationAttributeStore.EnsureValidationContext(validationContext);
     ValidationAttributeStore.TypeStoreItem     typeStoreItem     = this.GetTypeStoreItem(validationContext.ObjectType);
     ValidationAttributeStore.PropertyStoreItem propertyStoreItem = typeStoreItem.GetPropertyStoreItem(validationContext.MemberName);
     return(propertyStoreItem.PropertyType);
 }
Ejemplo n.º 3
0
            private Dictionary <string, ValidationAttributeStore.PropertyStoreItem> CreatePropertyStoreItems()
            {
                Dictionary <string, ValidationAttributeStore.PropertyStoreItem> strs = new Dictionary <string, ValidationAttributeStore.PropertyStoreItem>();
                PropertyDescriptorCollection properties = TypeDescriptor.GetProperties(this.m_type);

                foreach (PropertyDescriptor property in properties)
                {
                    ValidationAttributeStore.PropertyStoreItem propertyStoreItem = new ValidationAttributeStore.PropertyStoreItem(property.PropertyType, ValidationAttributeStore.TypeStoreItem.GetExplicitAttributes(property).Cast <Attribute>());
                    strs[property.Name] = propertyStoreItem;
                }
                return(strs);
            }
Ejemplo n.º 4
0
            internal bool TryGetPropertyStoreItem(string propertyName, out ValidationAttributeStore.PropertyStoreItem item)
            {
                if (!string.IsNullOrEmpty(propertyName))
                {
                    if (this.m_propertyStoreItems == null)
                    {
                        lock (this.m_syncRoot)
                        {
                            if (this.m_propertyStoreItems == null)
                            {
                                this.m_propertyStoreItems = this.CreatePropertyStoreItems();
                            }
                        }
                    }
                    return(this.m_propertyStoreItems.TryGetValue(propertyName, out item));
                }

                throw new ArgumentNullException("propertyName");
            }