Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/337.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/entity-framework/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 未找到适用于实体类型';OracleCredential';_C#_Entity Framework_Entity Framework Core_Dbcontext - Fatal编程技术网

C# 未找到适用于实体类型';OracleCredential';

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

在我的WinForm项目中,我安装了Microsoft.EntityFrameworkCore v3.1.8和Oracle.EntityFrameworkCore v3.19.80

我创建了一个数据库上下文,并指出了如何获取连接字符串(简化):

当我第一次尝试使用它时,我发现错误:

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; }
    }
}