- 修复 Oracle CodeFirst clob/blob cast 转换问题;

This commit is contained in:
2881099
2025-02-10 19:00:14 +08:00
parent 2f32bb6165
commit 2695de562f
4 changed files with 13 additions and 17 deletions

View File

@@ -390,8 +390,9 @@ and not exists(select 1 from all_constraints where constraint_name = a.index_nam
insertvalue = _commonUtils.QuoteSqlName(tbstructcol.column);
if (tbcol.Attribute.DbType.StartsWith(tbstructcol.sqlType, StringComparison.CurrentCultureIgnoreCase) == false)
{
var dbtypeNoneNotNull = Regex.Replace(tbcol.Attribute.DbType, @"(NOT\s+)?NULL", "");
insertvalue = $"cast({insertvalue} as {dbtypeNoneNotNull})";
var dbtypeNoneNotNull = Regex.Replace(tbcol.Attribute.DbType, @"(NOT\s+)?NULL", "").Trim();
if (dbtypeNoneNotNull != "CLOB" && dbtypeNoneNotNull != "BLOB")
insertvalue = $"cast({insertvalue} as {dbtypeNoneNotNull})";
}
if (tbcol.Attribute.IsNullable != tbstructcol.is_nullable)
insertvalue = $"nvl({insertvalue},{tbcol.DbDefaultValue})";