I'm migrating some applications to .NET Core and I have to inject a value from web.config.
Using .Net Framework (4.7.2) I did it using Dependency.OnAppSettingsValue. But I cannot find this option any more when I migrate to .NET Core (3.0) or .NET Standard (2.0).
I'm using Castle Windsor (5.0.1) and Castle Core (4.4.0).
container.Register(Component.For<IMigration>()
.ImplementedBy<SchemaMigration>()
.LifestyleTransient()
.DependsOn(Dependency.OnAppSettingsValue("createIndexes", "NHibernate.CreateIndexes")));
How can I do this in .NET Core 3.0?
@Mark Seeman shows how to let windsor provide primitive dependencies from AppSettings in his blogpost.
To resolve from IConfiguration, You can implement a variation like this
Add the resolver to windsor by passing the IConfiguration object