Ejemplo n.º 1
0
 private static void AddNecessaryAnnotations(NullableSqlType nullableSqlType, PropertyInfoWithAttributes propertyInfoWithAttributes)
 {
     foreach (var attribute in propertyInfoWithAttributes.Attributes)
     {
         DataAnnotationAttributeHandler.ProcessAttribute(nullableSqlType, attribute);
     }
 }
Ejemplo n.º 2
0
    public static SqlColumnDeclaration Convert(PropertyInfoWithAttributes propertyInfoWithAttributes)
    {
        var nullableSqlType = ClrTypeToSqlTypeConverter.Convert(propertyInfoWithAttributes.PropertyInfo.PropertyType);
        var name            = propertyInfoWithAttributes.PropertyInfo.Name;

        AddNecessaryAnnotations(nullableSqlType, propertyInfoWithAttributes);
        return(new SqlColumnDeclaration(name, nullableSqlType));
    }
    private static PropertyInfoWithAttributes CreatePropertyInfoWithAttributes(PropertyInfo propertyInfo)
    {
        var attributes = propertyInfo
                         .GetCustomAttributes(false)
                         .Where(att => att.GetType().Namespace?.Contains("System.ComponentModel.DataAnnotations") ?? false)
                         .ToList();

        var result = new PropertyInfoWithAttributes(propertyInfo, attributes);

        return(result);
    }