列设置nullable只支持RequiredAttribute和Nullable<>

This commit is contained in:
falcon 2022-09-29 17:32:09 +08:00
parent e8b8b6000d
commit dfc4e91cd6

View File

@ -37,13 +37,13 @@ namespace Falcon.SugarApi.DatabaseDefinitions
//if (sc != null) { //if (sc != null) {
// c.IsNullable = sc.IsNullable; // c.IsNullable = sc.IsNullable;
//} //}
var isNullableTypes = new Type[] { typeof(string) }; //var isNullableTypes = new Type[] { typeof(string) };
if (isNullableTypes.Contains(pt)) { //if (isNullableTypes.Contains(pt)) {
c.IsNullable = true; // c.IsNullable = true;
} //}
else { //else {
c.IsNullable = false; // c.IsNullable = false;
} //}
//if (pt == typeof(string) && pt.GetCustomAttribute<RequiredAttribute>() == null) { //if (pt == typeof(string) && pt.GetCustomAttribute<RequiredAttribute>() == null) {
// c.IsNullable = true; // c.IsNullable = true;
//} //}