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