Skip to content

Provide an extension to parse AppSettings in app.config( web.config) section into specified DOM.

License

Notifications You must be signed in to change notification settings

flyneth/AppSettings.Unity

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

AppSettings.Unity

AppSettings.Unity is an extension to parse AppSettings in app.config( web.config) section into specified DOM.

Default resolve your specified appsetting model as a Singleton (ContainerControlledLifetimemanager).

Usage

Add the package to your project.

Where you configure your IUnityContainer add this line (assume your custom appsetting model is CustomAppSettings):

Container.RegisterAppSettings<CustomAppSettings>();

Resolve a dependent value

You can resove the appsetting model by Unity dependency injection.

  • Construtor DI

    public class Demo
        {
            private readonly CustomAppSettings customAppSettings;
    
            public Demo(CustomAppSettings customAppSettings)
            {
                this.customAppSettings = customAppSettings;
            }
    
            public void DoSomething()
            {
                // Use the value of CustomAppSettings model.
                // ....
            }
    }
  • Resolve a dependent value by configured Unity Container.

    var appSettings = Container.Resolve<CustomAppSettings>();

About

Provide an extension to parse AppSettings in app.config( web.config) section into specified DOM.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages