ibatis-user-cs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Schall <mike.sch...@gmail.com>
Subject Re: Set ConnectionString per Thread/CallContext
Date Wed, 01 Feb 2006 20:53:45 GMT
Is this going to be part of 1.3?  And if so, when will it release?

I'm using the OpenConnection method for now.  It seems to work fine. 
I assume if I open the connection I should close it as well?  Do I
need to dispose it?

On 2/1/06, Gilles Bayon <ibatis.net@gmail.com> wrote:
> It depends which version of iBTAIS you used, but there must be a method
>
> OpenConnection(string connectionString) on the SqlMapper or the DaoManager
>
> Remarks : In Future version, you will be able to plug a custom DataSource
> (which implement IDataSource) on the SqlMapper and so do what you want, the
> method OpenConnection( string connectionString)... will certainly be
> removed.
>
> The custom DataSource will build the connectionstring base on the
> thread/callcontext setting, this will solve your problem.
>
> The current version in SVN already used an IDataSource and so you could used
> what I said.
> I expect that I answer your question
> -Gilles
>
>
>
> On 2/1/06, Michael Schall <mike.schall@gmail.com> wrote:
> > I need to be able to have a map switch which database server it is
> > hitting for certain queries.  I have this working however it is not a
> > per thread/callcontext setting.  It changes it for the map so each
> > thread will start using a the changed setting.  Is there a workaround
> > for this?
> >
> > My code looks like this
> >
> > --- use ---
> >
> >        Dim mapper As SqlMapper = DatabaseManager.Instance()
> >        mapper.DataSource.ConnectionString =
> connectionString.ConnectionString
> >
> >        mapper.QueryWithRowDelegate(...)
> >
> > --- configure --
> >
> >        Public Sub Configure(ByVal configurationFile As FileInfo)
> >
> >                Dim builder As DomSqlMapBuilder = New DomSqlMapBuilder()
> >                _mapper = builder.Configure(configurationFile)
> >
> >        End Sub
> >
> >        Friend Function Instance() As SqlMapper
> >                Dim mapper As SqlMapper
> >                SyncLock (_lock)
> >                        mapper = _mapper
> >                End SyncLock
> >                Return mapper
> >        End Function
> >
>
>

Mime
View raw message