ConfigInjectorContributors / ConfigInjector

A simple way to inject strongly-typed configuration settings into your application via [web|app].config.
https://www.nuget.org/packages/ConfigInjector/
MIT License
61 stars 16 forks source link

Simple injector #37

Open jrwpatterson opened 6 years ago

jrwpatterson commented 6 years ago

Any Idea how to use this with simple injector I'm racking my brain!

uglybugger commented 6 years ago

I think the registration call you're looking for in Simple Injector is RegisterSingleton.

The code (completely untested) might look something like this:

ConfigurationConfigurator.RegisterConfigurationSettings()
    .FromAssemblies(ThisAssembly)
    .RegisterWithContainer(configSetting =>
        container.RegisterSingleton(configSetting.GetType(), configSetting)
    )
    .DoYourThing();

Does that help?

jrwpatterson commented 6 years ago

Cool I might give it a goo this weekend


From: Andrew Harcourt notifications@github.com Sent: Friday, March 23, 2018 9:24:29 PM To: ConfigInjectorContributors/ConfigInjector Cc: jrwpatterson; Author Subject: Re: [ConfigInjectorContributors/ConfigInjector] Simple injector (#37)

I think the registration call you're looking for in Simple Injector is RegisterSingleton.

The code (completely untested) might look something like this:

ConfigurationConfigurator.RegisterConfigurationSettings() .FromAssemblies(ThisAssembly) .RegisterWithContainer(configSetting => container.RegisterSingleton(configSetting.GetType(), configSetting) ) .DoYourThing();

Does that help?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/ConfigInjectorContributors/ConfigInjector/issues/37#issuecomment-375628944, or mute the threadhttps://github.com/notifications/unsubscribe-auth/ARSmONRc8CSw2_7p7_4NaDSmVTqe2ZSFks5thNttgaJpZM4S3_2q.