system.collections.generic.idictionary中的错误 [英] error in system.collections.generic.idictionary

查看:182
本文介绍了system.collections.generic.idictionary中的错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我运行以下命令时

when i am running following commands

public abstract class ConnectionProvider : IConnectionProvider, IDisposable
   {
       private string connString;
       private IDriver driver;
       private bool _isAlreadyDisposed;

       protected virtual string ConnectionString
       {
           get
           {
               return this.connString;
           }
       }

       public IDriver Driver
       {
           get
           {
               return this.driver;
           }
       }

       static ConnectionProvider()
       {
       }

       ~ConnectionProvider()
       {
           this.Dispose(false);
       }

       public virtual void CloseConnection(IDbConnection conn)
       {
           try
           {
               conn.Close();
           }
           catch (Exception ex)
           {
               throw new ADOException("Could not close " + conn.GetType().ToString() + " connection", ex);
           }
       }

       public virtual void Configure(IDictionary settings)
       {
           this.connString = settings[(object)"hibernate.connection.connection_string"] as string;
           if (this.connString == null)
               this.connString = this.GetNamedConnectionString(settings);
           if (this.connString == null)
               throw new HibernateException("Could not find connection string setting (set hibernate.connection.connection_string or hibernate.connection.connection_string_name property)");
           this.ConfigureDriver(settings);
       }

       protected virtual string GetNamedConnectionString(IDictionary settings)
       {
           string index = settings[(object)"hibernate.connection.connection_string_name"] as string;
           if (index == null)
               return (string)null;
             ConnectionStringSettings connectionStringSettings = ConfigurationManager.ConnectionStrings[index];
           if (connectionStringSettings == null)
               throw new HibernateException(string.Format("Could not find named connection string {0}", (object)index));
           else
               return connectionStringSettings.ConnectionString;
       }

       protected virtual void ConfigureDriver(IDictionary settings)
       {
           string name = settings[(object)"hibernate.connection.driver_class"] as string;
           if (name == null)
               throw new HibernateException("The hibernate.connection.driver_class must be specified in the NHibernate configuration section.");
           try
           {
               this.driver = (IDriver)Activator.CreateInstance(ReflectHelper.ClassForName(name));
               this.driver.Configure(settings); // error in these line
           }
           catch (Exception ex)
           {
               throw new HibernateException("Could not create the driver from " + name + ".", ex);
           }
       }

       public abstract IDbConnection GetConnection();

       public void Dispose()
       {
           this.Dispose(true);
       }

       protected virtual void Dispose(bool isDisposing)
       {
           if (this._isAlreadyDisposed)
               return;
           if (isDisposing)
           this._isAlreadyDisposed = true;
           GC.SuppressFinalize((object)this);
       }
   }



出现
错误
nhibernate.driver.idriver.configure(system.collections.generic.idictionary)的最佳重载方法匹配具有一些无效的参数

不知道我在哪里被击中

等待您的回应



getting error as

best overload method match for nhibernate.driver.idriver.configure ( system.collections.generic.idictionary) has some invalid arguments

do not know where to i got struck

Waiting for your response

推荐答案



异常消息表明您的代码中存在什么错误.

您正在为该函数传递不正确的参数类型.

this.driver.Configure不接受任何具有IDictionary type的参数.使用F12转到该功能并检查所有受支持的参数.

希望您能解决您的问题,

谢谢
-Amit
Hi,

Exception message says that what mistake is there in your code.

You are passing incorrect argument type for that function.

this.driver.Configure do not accept any parameter with IDictionary type. Go to that function using F12 and check all supported parameters.

Hope you can resolve your issue,

thanks
-Amit


这篇关于system.collections.generic.idictionary中的错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆