@@ -433,6 +433,45 @@ var session = sessions.OpenSession(conn);
433
433
434
434
</sect1 >
435
435
436
+ <sect1 id =" configuration-provider" >
437
+ <title >Using a custom configuration provider</title >
438
+
439
+ <para >
440
+ By default, NHibernate attempts to read the <literal >hibernate-configuration</literal > section
441
+ through the .Net <literal >ConfigurationManager</literal >. Some environments do not support it, so
442
+ NHibernate provides a way to set a custom configuration provider, through the
443
+ <literal >NHibernate.Cfg.ConfigurationProvider.Current</literal > property.
444
+ </para >
445
+
446
+ <para >
447
+ To disable the configuration provider, in case you configure NHibernate entirely programmatically,
448
+ set this property to <literal >null</literal >.
449
+ </para >
450
+
451
+ <programlisting ><![CDATA[ ConfigurationProvider.Current = null;]]> </programlisting >
452
+
453
+ <para >
454
+ To provide directly the <literal >System.Configuration.Configuration</literal > instance to use, assign
455
+ the <literal >Current</literal > property with an instance of
456
+ <literal >NHibernate.Cfg.SystemConfigurationProvider</literal > built with your
457
+ <literal >Configuration</literal > instance.
458
+ </para >
459
+
460
+ <programlisting ><![CDATA[ ConfigurationProvider.Current = new SystemConfigurationProvider(yourConfig);]]> </programlisting >
461
+
462
+ <para >
463
+ You may also derive a custom provider from <literal >NHibernate.Cfg.ConfigurationProvider</literal >,
464
+ implements its abstract methods, and assign an instance of your custom provider to the
465
+ <literal >NHibernate.Cfg.ConfigurationProvider.Current</literal > property.
466
+ </para >
467
+
468
+ <para >
469
+ Changes of the <literal >ConfigurationProvider.Current</literal > property value are to be done very
470
+ early in the application lifecycle, before any other call on a NHibernate API. Otherwise they
471
+ may not be taken into account.
472
+ </para >
473
+ </sect1 >
474
+
436
475
<sect1 id =" configuration-optional" >
437
476
<title >Optional configuration properties</title >
438
477
0 commit comments