Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: .NET1.0
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);
        }
    }
 
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 18-Jul-12 2:26am
Edited 18-Jul-12 3:41am
v5
Comments
AlluvialDeposit at 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

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

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
  Permalink  
Comments
gowthammanju at 18-Jul-12 8:13am
   
i too checked but still i can not find solution
@amitgajjar at 18-Jul-12 8:32am
   
can you post all overloaded function def'n ? use Improve question.
@amitgajjar at 18-Jul-12 8:33am
   
Use F12 and check if it goes to the same Configure function ?
gowthammanju at 18-Jul-12 8:35am
   
updated check it
@amitgajjar at 18-Jul-12 8:41am
   
one question, why you are calling Configure from ConfigureDriver and vice versa ?
@amitgajjar at 18-Jul-12 8:42am
   
is your posted Configure function is the function you are calling using Reflactor ? please make sure.
gowthammanju at 18-Jul-12 8:45am
   
hmmm in order to read connection string from hbm.xml
@amitgajjar at 18-Jul-12 8:48am
   
See this link to read xml.
@amitgajjar at 18-Jul-12 8:50am
   
is your question answered ? if so, Accept the solution so other can refer this.
 
thanks
gowthammanju at 18-Jul-12 8:54am
   
k my question is i need to extend the some specific nhibernate class so that i should process some values and return connection string which i needed rather than original one

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

  Print Answers RSS
0 OriginalGriff 329
1 Maciej Los 290
2 Sergey Alexandrovich Kryukov 230
3 Shweta N Mishra 185
4 PIEBALDconsult 149
0 OriginalGriff 7,660
1 Sergey Alexandrovich Kryukov 7,072
2 DamithSL 5,604
3 Manas Bhardwaj 4,986
4 Maciej Los 4,760


Advertise | Privacy | Mobile
Web03 | 2.8.1411023.1 | Last Updated 18 Jul 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100