SqlSugar查询Oracle中的表报错Oracle.ManagedDataAccess.Client.OracleException (0x80004005): ORA-00942: 表或视图不存在如何修改
Oracle表名似乎是区分大小写的,所有要设置一下
数据库表名:Bill
模型类:
[SugarTable("Bill")]
public class Bill
{
/// <summary>
/// 备 注:
/// 默认值:
///</summary>
[SugarColumn(ColumnName="Id" ,IsPrimaryKey = true) ]
public byte[] Id { get; set; }
/// <summary>
/// 备 注:
/// 默认值:
///</summary>
[SugarColumn(ColumnName="TenantId" ) ]
public byte[]? TenantId { get; set; }
/// <summary>
/// 备 注:
/// 默认值:
///</summary>
[SugarColumn(ColumnName="WarehouseId" ) ]
public string? WarehouseId { get; set; }
}
这里明明是一样的,但是sqlsugar好像会自动转大写,所以在创建Client的时候这样写
var connStr = _Configuration.GetConnectionString("Default");
// 创建SqlSugarClient
_SqlSugarClient = new SqlSugarClient(new ConnectionConfig() {
// 1.1、配置连接地址
ConnectionString = connStr,
DbType = DbType.Oracle,
IsAutoCloseConnection = true,
MoreSettings = new ConnMoreSettings()
{
// 加上这一句
IsAutoToUpper = false
}
});