- 修复 QuestDb CodeFirst AutoSubtableAttribute/ColumnAttribute判断bug

This commit is contained in:
dailyccc 2023-03-05 00:32:45 +08:00
parent 59f79a56f3
commit 5e256922e6

View File

@ -181,7 +181,11 @@ namespace FreeSql.QuestDb
var timeAttr = propety.GetCustomAttribute<AutoSubtableAttribute>(); var timeAttr = propety.GetCustomAttribute<AutoSubtableAttribute>();
if (timeAttr != null) if (timeAttr != null)
{ {
var colName = tb.Columns.FirstOrDefault(it => it.Key == propety.Name).Value; var ckey = propety.Name;
var colNameAttr = propety.GetCustomAttribute<ColumnAttribute>();
if (!string.IsNullOrWhiteSpace(colNameAttr?.Name))
ckey = colNameAttr.Name;
var colName = tb.Columns.FirstOrDefault(it => it.Key == ckey).Value;
sbalter.Append( sbalter.Append(
$" TIMESTAMP({colName.Attribute.Name}) PARTITION BY {timeAttr.SubtableType};{Environment.NewLine}"); $" TIMESTAMP({colName.Attribute.Name}) PARTITION BY {timeAttr.SubtableType};{Environment.NewLine}");
} }