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 Set ConnectionString per Thread/CallContext
Date Wed, 01 Feb 2006 19:14:45 GMT
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