Esempio n. 1
0
        private IField MakeField(FieldDescriptor fieldDescriptor)
        {
            var fieldGenerationContext = new FieldGenerationContext(fieldDescriptor);

            var metadata = this._fieldMetadataProviderCollection
                           .GetMetadataProviders()
                           .SelectMany(metaProvider => metaProvider.GetMetadata(fieldGenerationContext));

            return(new Field(fieldDescriptor.Name, fieldDescriptor.Value, metadata));
        }
Esempio n. 2
0
        public IEnumerable <KeyValuePair <string, object> > GetMetadata(FieldGenerationContext fieldGenerationContext)
        {
            var attributes = fieldGenerationContext.FieldDescriptor.CustomAttributes;
            var results    = new List <KeyValuePair <string, object> >();

            foreach (var validationMetaProvider in this._validationMetaProviders)
            {
                foreach (var attribute in attributes)
                {
                    results.AddRange(validationMetaProvider.GetMetadata(attribute));
                }
            }

            return(results);
        }