Click here to Skip to main content
15,887,585 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
when i am running following commands

C#
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);
       }
   }


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
Posted
Updated 18-Jul-12 2:41am
v5
Comments
StianSandberg 18-Jul-12 7:49am    
Tha IDriver.Configure Method requires a IDictionary<string,string>! Are you sure you are sending a IDictionary<string,string> to your method?

1 solution

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
 
Share this answer
 
Comments
gowthammanju 18-Jul-12 8:13am    
i too checked but still i can not find solution
AmitGajjar 18-Jul-12 8:32am    
can you post all overloaded function def'n ? use Improve question.
AmitGajjar 18-Jul-12 8:33am    
Use F12 and check if it goes to the same Configure function ?
gowthammanju 18-Jul-12 8:35am    
updated check it
AmitGajjar 18-Jul-12 8:41am    
one question, why you are calling Configure from ConfigureDriver and vice versa ?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900