C# 未找到适用于实体类型';OracleCredential';
在我的WinForm项目中,我安装了Microsoft.EntityFrameworkCore v3.1.8和Oracle.EntityFrameworkCore v3.19.80 我创建了一个数据库上下文,并指出了如何获取连接字符串(简化): 当我第一次尝试使用它时,我发现错误:C# 未找到适用于实体类型';OracleCredential';,c#,entity-framework,entity-framework-core,dbcontext,C#,Entity Framework,Entity Framework Core,Dbcontext,在我的WinForm项目中,我安装了Microsoft.EntityFrameworkCore v3.1.8和Oracle.EntityFrameworkCore v3.19.80 我创建了一个数据库上下文,并指出了如何获取连接字符串(简化): 当我第一次尝试使用它时,我发现错误: using (OraContext _context = new OraContext()) { var count = await _context.MyTable.CountAsync(); //exce
using (OraContext _context = new OraContext())
{
var count = await _context.MyTable.CountAsync(); //exception here
}
异常:未找到实体类型“OracleCredential”的合适构造函数。
以下构造函数的参数无法绑定到实体类型的属性:
无法在中绑定“userId”、“password”
'OracleCredential(字符串用户ID、SecureString密码)';
无法在中绑定“userId”、“password”、“dbaPrivilege”
'OracleCredential(字符串用户ID、SecureString密码、OracleDBAPrivilege)';
无法在中绑定“userId”、“password”、“proxyUserId”、“proxyPassword”
'OracleCredential(字符串用户ID、SecureString密码、字符串代理用户ID、SecureString代理密码)';
无法在中绑定“密码”、“代理密码”
'OracleCredential(SecureString密码、SecureString代理密码)'
在类似情况下,建议构造函数不带EntityFramework的参数。但OracleCredential没有这个功能
namespace Oracle.ManagedDataAccess.Client
{
public sealed class OracleCredential
{
public bool m_bUserIdSet;
public bool m_bPasswordSet;
public bool m_bProxyUserIdSet;
public bool m_bProxyPasswordSet;
public OracleCredential(string userId, SecureString password);
public OracleCredential(string userId, SecureString password, OracleDBAPrivilege dbaPrivilege);
public OracleCredential(string userId, SecureString password, string proxyUserId, SecureString proxyPassword);
public string UserId { get; }
public SecureString Password { get; }
public string ProxyUserId { get; }
public SecureString ProxyPassword { get; }
public OracleDBAPrivilege DBAPrivilege { get; }
}
}
在这种情况下我该怎么办?提前谢谢
namespace Oracle.ManagedDataAccess.Client
{
public sealed class OracleCredential
{
public bool m_bUserIdSet;
public bool m_bPasswordSet;
public bool m_bProxyUserIdSet;
public bool m_bProxyPasswordSet;
public OracleCredential(string userId, SecureString password);
public OracleCredential(string userId, SecureString password, OracleDBAPrivilege dbaPrivilege);
public OracleCredential(string userId, SecureString password, string proxyUserId, SecureString proxyPassword);
public string UserId { get; }
public SecureString Password { get; }
public string ProxyUserId { get; }
public SecureString ProxyPassword { get; }
public OracleDBAPrivilege DBAPrivilege { get; }
}
}