Exemple #1
0
 private static void AddNecessaryAnnotations(NullableSqlType nullableSqlType, PropertyInfoWithAttributes propertyInfoWithAttributes)
 {
     foreach (var attribute in propertyInfoWithAttributes.Attributes)
     {
         DataAnnotationAttributeHandler.ProcessAttribute(nullableSqlType, attribute);
     }
 }
Exemple #2
0
 private static void HandleStringLengthAnnotation(NullableSqlType nullableSqlType, object attribute)
 {
     if (attribute is StringLengthAttribute stringLengthAttribute)
     {
         nullableSqlType.SqlType.MaximumCharLength = stringLengthAttribute.MaximumLength;
     }
 }
 public SqlColumnDeclaration(string name, NullableSqlType nullableSqlType)
 {
     if (string.IsNullOrWhiteSpace(name))
     {
         throw new ArgumentException("Value cannot be null or whitespace.", nameof(name));
     }
     Name            = name;
     NullableSqlType = nullableSqlType ?? throw new ArgumentNullException(nameof(nullableSqlType));
 }
    public static NullableSqlType Convert(Type clrType)
    {
        ValidateClrTypeIsTranslatable(clrType);
        var underlyingType = StripNullableOuterGeneric(clrType);
        var sqlType        = GetSqlType(underlyingType);

        var isNullable      = IsClrTypeNullable(clrType);
        var nullableSqlType = new NullableSqlType(sqlType, isNullable);

        return(nullableSqlType);
    }
Exemple #5
0
 public static void ProcessAttribute(NullableSqlType nullableSqlType, object attribute)
 {
     HandleStringLengthAnnotation(nullableSqlType, attribute);
 }