public int?GetMaxLength(IPropertyInformation propertyInfo)
        {
            ArgumentUtility.CheckNotNull("propertyInfo", propertyInfo);

            var attribute = propertyInfo.GetCustomAttribute <ILengthConstrainedPropertyAttribute> (true);

            return(attribute != null ? attribute.MaximumLength : null);
        }
        public bool IsNullable(IPropertyInformation propertyInfo)
        {
            ArgumentUtility.CheckNotNull("propertyInfo", propertyInfo);

            var attribute = propertyInfo.GetCustomAttribute <INullablePropertyAttribute> (true);

            return(attribute == null || attribute.IsNullable);
        }
Example #3
0
        private MappingValidationResult Validate(IPropertyInformation propertyInfo)
        {
            ArgumentUtility.CheckNotNull("propertyInfo", propertyInfo);

            var storageClassAttribute = propertyInfo.GetCustomAttribute <StorageClassAttribute> (true);

            if (storageClassAttribute != null && storageClassAttribute.StorageClass != StorageClass.Persistent &&
                storageClassAttribute.StorageClass != StorageClass.Transaction)
            {
                return(MappingValidationResult.CreateInvalidResultForProperty(
                           propertyInfo,
                           "Only StorageClass.Persistent and StorageClass.Transaction are supported for property '{0}' of class '{1}'.",
                           propertyInfo.Name,
                           propertyInfo.DeclaringType.Name));
            }
            return(MappingValidationResult.CreateValidResult());
        }
 public T GetCustomAttribute <T> (bool inherited) where T : class
 {
     return(_implementationPropertyInfo.GetCustomAttribute <T> (inherited));
 }