mirror of
https://gitee.com/ThingsGateway/ThingsGateway.git
synced 2025-10-27 21:57:10 +08:00
修复 sqldb oracle11 标识符过长
This commit is contained in:
@@ -15,9 +15,9 @@ using ThingsGateway.Core;
|
||||
namespace ThingsGateway.Plugin.SqlDB;
|
||||
|
||||
[SugarTable(TableDescription = "设备采集实时表")]
|
||||
[SugarIndex("index_Name", nameof(SQLHistoryValue.Name), OrderByType.Desc)]
|
||||
[SugarIndex("index_DeviceName", nameof(SQLHistoryValue.DeviceName), OrderByType.Desc)]
|
||||
[SugarIndex("index_CollectTime", nameof(SQLHistoryValue.CollectTime), OrderByType.Desc)]
|
||||
[SugarIndex("{table}_index_Name", nameof(SQLRealValue.Name), OrderByType.Desc)]
|
||||
[SugarIndex("{table}_index_DeviceName", nameof(SQLRealValue.DeviceName), OrderByType.Desc)]
|
||||
[SugarIndex("{table}_index_CollectTime", nameof(SQLRealValue.CollectTime), OrderByType.Desc)]
|
||||
public class SQLRealValue : IPrimaryIdEntity
|
||||
{
|
||||
[SugarColumn(ColumnDescription = "Id", IsPrimaryKey = true)]
|
||||
|
||||
@@ -49,6 +49,13 @@ public static class SqlDBBusinessDatabaseUtil
|
||||
ConfigureExternalServices = configureExternalServices,
|
||||
}
|
||||
);
|
||||
if (sqlSugarClient.CurrentConnectionConfig.DbType == DbType.Oracle)
|
||||
{
|
||||
sqlSugarClient.CurrentConnectionConfig.MoreSettings = new()
|
||||
{
|
||||
MaxParameterNameLength = 30
|
||||
};
|
||||
}
|
||||
DbContext.AopSetting(sqlSugarClient);//aop配置
|
||||
return sqlSugarClient;
|
||||
}
|
||||
|
||||
@@ -61,8 +61,10 @@ YitIdHelper.NextId())
|
||||
{
|
||||
var db = SqlDBBusinessDatabaseUtil.GetDb(_driverPropertys);
|
||||
db.CodeFirst.InitTables(typeof(SQLHistoryValue));
|
||||
db.MappingTables.Add(nameof(SQLRealValue), _driverPropertys.ReadDBTableName);
|
||||
db.CodeFirst.InitTables(typeof(SQLRealValue));
|
||||
//新功能 5.0.2.3
|
||||
db.CodeFirst.As<SQLRealValue>(_driverPropertys.ReadDBTableName).InitTables<SQLRealValue>();
|
||||
//该功能索引名要加占位符
|
||||
//[SugarIndex("{table}index_codetable1_name",nameof(CodeFirstTable1.Name),OrderByType.Asc)]
|
||||
await base.ProtectedBeforStartAsync(cancellationToken);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user