I am attempting to use the ConfigureAndWatch. The code I'm using is
not throwing an exception, however if I change a sqlMap file, it is
not being reloaded. I have included a condensed DatabaseManager class
below. Any hints would be great. I'm using Mapper 1.3. (Looking to
upgrade, but no time for regression testing right now)
Thanks for your time.
Mike
Public NotInheritable Class DatabaseManager
Private Shared _log As ILogger =
LogManager.GetLogger(GetType(DatabaseManager))
Private Shared _lock As Object = New Object()
Private Shared _mapper As SqlMapper
Private Shared _configurationFile As FileInfo
Public Shared Sub Configure(ByVal configurationFile As FileInfo)
If configurationFile Is Nothing Then
Throw New
System.ArgumentNullException("configurationFile")
End If
_log.Debug("Configuring database access using configuration file
{0}", configurationFile.FullName)
_configurationFile = configurationFile
'Initialize the _mapper
Dim mapper As SqlMapper = Instance()
_log.Debug("Done configuring database access using configuration
file {0} ", configurationFile.Name)
End Sub
Friend Shared Function Instance() As SqlMapper
If _mapper Is Nothing Then
SyncLock (_lock)
If _mapper Is Nothing Then
Dim handler As ConfigureHandler = New
ConfigureHandler(AddressOf
resetMapper)
Dim builder As DomSqlMapBuilder = New
DomSqlMapBuilder()
_mapper =
builder.ConfigureAndWatch(_configurationFile, handler)
End If
End SyncLock
End If
Return _mapper
End Function
Protected Shared Sub resetMapper(ByVal obj As Object)
SyncLock (_lock)
_mapper = Nothing
End SyncLock
End Sub
Private Sub New()
End Sub
End Class