internal string GetCollate(SqlDbTypeAttribute att) { if (att != null && att.Collation != null) { return(att.Collation); } return(null); }
internal SqlDbTypePair GetSqlDbType(SqlDbTypeAttribute att, Type type) { if (att != null && att.HasSqlDbType) { return(new SqlDbTypePair(att.SqlDbType, att.UserDefinedTypeName)); } return(GetSqlDbTypePair(type.UnNullify())); }
internal int?GetSqlScale(SqlDbTypeAttribute att, SqlDbType sqlDbType) { if (att != null && att.HasScale) { return(att.Scale); } return(defaultScale.TryGetS(sqlDbType)); }
internal int?GetSqlScale(SqlDbTypeAttribute att, SqlDbType sqlDbType) { if (att != null && att.HasScale) { if (sqlDbType != SqlDbType.Decimal) { throw new InvalidOperationException($"{sqlDbType} can not have Scale"); } return(att.Scale); } return(defaultScale.TryGetS(sqlDbType)); }
internal int?GetSqlSize(SqlDbTypeAttribute att, PropertyRoute route, SqlDbType sqlDbType) { if (att != null && att.HasSize) { return(att.Size); } if (route != null && route.Type == typeof(string)) { var sla = ValidatorAttribute <StringLengthValidatorAttribute>(route); if (sla != null) { return(sla.Max == -1 ? int.MaxValue : sla.Max); } } return(defaultSize.TryGetS(sqlDbType)); }