public InternalPropertyBuilder Apply(InternalPropertyBuilder propertyBuilder)
        {
            if (propertyBuilder.Metadata.ClrType == typeof(string))
            {
                propertyBuilder.HasMaxLength(32, ConfigurationSource.Convention);
            }

            if (propertyBuilder.Metadata.ClrType == typeof(byte[]))
            {
                propertyBuilder.HasMaxLength(65535, ConfigurationSource.Convention);
            }
            return(propertyBuilder);
        }
 public InternalPropertyBuilder Apply(InternalPropertyBuilder propertyBuilder)
 {
     if (propertyBuilder.Metadata.ClrType == typeof(string))
     {
         Console.WriteLine($"default string length apply. entity:{propertyBuilder.Metadata.DeclaringType.Name}.property:{propertyBuilder.Metadata.Name}");
         propertyBuilder.HasMaxLength(32, ConfigurationSource.Convention);
     }
     return(propertyBuilder);
 }
 public InternalPropertyBuilder Apply(InternalPropertyBuilder propertyBuilder)
 {
     if (IsString(propertyBuilder) || !HasMaxLength(propertyBuilder))
     {
         return(propertyBuilder);
     }
     propertyBuilder.HasMaxLength(options.MaxLength[propertyBuilder.Metadata.Name], ConfigurationSource.Convention);
     return(propertyBuilder);
 }
Beispiel #4
0
        public override InternalPropertyBuilder Apply(InternalPropertyBuilder propertyBuilder, StringLengthAttribute attribute, PropertyInfo clrProperty)
        {
            Check.NotNull(propertyBuilder, nameof(propertyBuilder));
            Check.NotNull(attribute, nameof(attribute));

            if (attribute.MaximumLength > 0)
            {
                propertyBuilder.HasMaxLength(attribute.MaximumLength, ConfigurationSource.DataAnnotation);
            }

            return(propertyBuilder);
        }
 public override InternalPropertyBuilder Apply(InternalPropertyBuilder propertyBuilder, HasMaxLengthAttribute attribute, MemberInfo clrMember)
 {
     propertyBuilder.HasMaxLength(ConfigurationSource.DataAnnotation, attribute.HasMaxLength);
     return(propertyBuilder);
 }