Example #1
0
        public Boolean HasDefaultValue(Object target)
        {
            if (target == null)
            {
                throw Logger.Fatal.ArgumentNull(nameof(target));
            }

            var value = GetValue(target);

            return(DefaultValuePolicy.IsDefaultValue(value));
        }
        private Boolean IsMandatoryAndUnsupportedByDefaultValuePolicy(
            PropertyAccessor property,
            IEnumerable <ParameterAttribute> attributes
            )
        {
            if (!DefaultValuePolicy.SupportsType(property.PropertyTypeInfo) &&
                attributes.Any(a => a.Mandatory))
            {
                throw Logger.Fatal.ObjectMetadata(
                          SR.HarshProvisionerMetadata_MandatoryTypeNotSupportedByDefaultValuePolicy,
                          property.DeclaringType,
                          property.Name,
                          property.PropertyType,
                          DefaultValuePolicy.GetType()
                          );
            }

            return(false);
        }