连接GBase数据库创建表和列时能不能支持支持驼峰 返回
aa 发布于2026/1/4
例如我的表名aA_aA,列名Bb
使用
_db.CodeFirst.SetStringDefaultLength(999).InitTables(entityTypes);
同步表结构时会把表名列名全部转为小写
我已经配置了
MoreSettings = new ConnMoreSettings()
{
PgSqlIsAutoToLower = false,
IsAutoToUpper = false,
}
麻烦大佬看看有没有解决方案
GBase版本是8s
另外我创建连接时用的DbType = SqlSugar.DbType.PostgreSQL,之前官方人说的用pg就行
如果我用DbType = SqlSugar.DbType.GBase,就会报错
DllNotFoundException: Unable to load DLL 'iclit09b.dll' or one of its dependencies: 找不到指定的模块。 (0x8007007E)
热忱回答(3)
-
fate sta VIP0
2026/1/6SqlSugar.GBaseCoreSqlSugarCore//程序启动时只执行一次InstanceFactory.CustomAssemblies =newSystem.Reflection.Assembly[] {typeof(GBaseProvider).Assembly };这行代码加了吗。
0 回复 -
fate sta VIP0
2026/1/6还有ODBC驱动。
0 回复 -
aa VIP0
2026/1/7@fate sta:加上了还是不行,原代码:
using Microsoft.AspNetCore.Mvc;
using SqlSugar;
using SqlSugar.GBase;
using Test.DB;
namespace Test.Controllers
{
public class test1Controller : Controller
{
public string create()
{
InstanceFactory.CustomAssemblies = new System.Reflection.Assembly[] { typeof(GBaseProvider).Assembly };
using var db = sugardb();
db.CodeFirst.SetStringDefaultLength(999).InitTables(typeof(aA));
return "";
}
public SqlSugarClient sugardb()
{
var config = new ConnectionConfig()
{
ConnectionString = "Server=localhost;database=testaa;User Id=postgres;Password=password01!;Port=5432;",
DbType = SqlSugar.DbType.PostgreSQL,
IsAutoCloseConnection = true,
MoreSettings = new ConnMoreSettings()
{
PgSqlIsAutoToLower = false,
IsAutoToUpper = false,
}
};
return new SqlSugarClient(config, db =>
{
db.Aop.OnExecutingChangeSql = (sql, pars) =>
{
Console.WriteLine(sql);
return new KeyValuePair<string, SugarParameter[]>(sql, pars);
};
});
}
}
}
创建的表:
using SqlSugar;
namespace Test.DB
{
[SugarTable("test_aA")]
public class aA
{
[SugarColumn(IsPrimaryKey = true, ColumnName = "Unid", Length = 32)]
public string unid { get; set; }
[SugarColumn(ColumnName = "Bt", IsNullable = true, Length = 1000)]
public string bt { get; set; }
[SugarColumn(ColumnName = "nR", IsNullable = true, ColumnDataType = "text")]
public string nr { get; set; }
}
}
0 回复