When using a external configuration file the EnableReflectionOptimizer is not set because NHibernate only check it in the app.config file (Environment class static constructor).
I guess only remove EnableReflectionOptimizer bool and change UseReflectionOptimizer method solve the problem :
Code:
public static bool UseReflectionOptimizer
{
get { return PropertiesHelper.GetBoolean(PropertyUseReflectionOptimizer, GlobalProperties); }
set { GlobalProperties[PropertyUseReflectionOptimizer] = value.ToString(); }
}
Code:
static Environment()
{
log.Info( "NHibernate " + Environment.Version );
GlobalProperties = new Hashtable();
GlobalProperties[ PropertyUseReflectionOptimizer ] = true.ToString();
LoadGlobalPropertiesFromAppConfig();
VerifyProperties( GlobalProperties );
}
I have not tested it because i can't compile here but it should work :).