protected override ModelMetadata CreateMetadata(IEnumerable<Attribute> attributes, Type containerType, Func<object> modelAccessor, Type modelType, string propertyName)
        {
            var result = new DataAnnotationsModelMetadata(this, containerType, modelAccessor, modelType, propertyName);

            RequiredAttribute requiredAttribute = attributes.OfType<RequiredAttribute>().FirstOrDefault();
            if (requiredAttribute != null)
            {
                result.IsRequired = true;
            }

            return result;
        }
        protected override ModelMetadata CreateMetadata(IEnumerable <Attribute> attributes, Type containerType, Func <object> modelAccessor, Type modelType, string propertyName)
        {
            var result = new DataAnnotationsModelMetadata(this, containerType, modelAccessor, modelType, propertyName);

            RequiredAttribute requiredAttribute = attributes.OfType <RequiredAttribute>().FirstOrDefault();

            if (requiredAttribute != null)
            {
                result.IsRequired = true;
            }

            return(result);
        }