Skip to content

Latest commit

 

History

History
19 lines (13 loc) · 1.18 KB

File metadata and controls

19 lines (13 loc) · 1.18 KB

Loading IoC Configuration

  • The dependency injection configuration can be loaded either from modules (see ../bindings-in-modules/index for more details on modules), or from XML Configuration file, in which both type binding as well as module classes can be specified (see ../xml-configuration-file/index for more details on XML Configuration file).
  • Before the configuration is loaded, an instance of OROptimizer.Diagnostics.Log.ILogHelperContext should be registered, using OROptimizer.Diagnostics.Log.LogHelper.RegisterContext(ILogHelperContext). An implementation of ILogHelperContext for log4net, OROptimizer.Diagnostics.Log.Log4NetHelperContext, can be found in Nuget package OROptimizer.Shared (referenced by IoC.Configuration library).

    Here is an example of registering the logger:

    csharp

    if (!OROptimizer.Diagnostics.Log.LogHelper.IsContextInitialized)
    OROptimizer.Diagnostics.Log.LogHelper.RegisterContext(

    new Log4NetHelperContext("MyApp.log4net.config"));

loading-from-xml.generated.rst loading-from-modules.rst