File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed
Src/NHibernate.Envers.Tests Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change 1
1
using System ;
2
2
using System . Collections . Generic ;
3
+ using System . IO ;
3
4
using System . Reflection ;
4
5
using NHibernate . Cfg ;
5
6
using NHibernate . Dialect ;
@@ -49,7 +50,7 @@ public void BaseSetup()
49
50
Cfg = new Cfg . Configuration ( ) ;
50
51
Cfg . SetEnversProperty ( ConfigurationKey . AuditStrategy , StrategyType ) ;
51
52
AddToConfiguration ( Cfg ) ;
52
- Cfg . Configure ( ) ;
53
+ Cfg . Configure ( configurationFile ( ) ) ;
53
54
addMappings ( ) ;
54
55
Cfg . IntegrateWithEnvers ( new AuditEventListener ( ) , EnversConfiguration ( ) ) ;
55
56
SessionFactory = Cfg . BuildSessionFactory ( ) ;
@@ -135,5 +136,14 @@ private void closeSessionAndAuditReader()
135
136
Session ? . Dispose ( ) ;
136
137
_auditReader = null ;
137
138
}
139
+
140
+ private static string configurationFile ( )
141
+ {
142
+ var baseDir = AppDomain . CurrentDomain . BaseDirectory ;
143
+ var relativeSearchPath = AppDomain . CurrentDomain . RelativeSearchPath ;
144
+ var folder = relativeSearchPath == null ? baseDir : Path . Combine ( baseDir , relativeSearchPath ) ;
145
+
146
+ return Path . Combine ( folder , "hibernate.cfg.xml" ) ;
147
+ }
138
148
}
139
149
}
You can’t perform that action at this time.
0 commit comments