I have upgraded to SM 3.0 and now, amongst other breaking changes I find that EqualToAppSetting is gone.
I used to be able to do
.Use<SomeType>().Ctor<SomeType>("connectionStr").EqualToAppSetting("myAppSetting");
where of course myAppSetting is pulled from the app.config or the web.config.
Anyone know how to do that now? or some other work around?
Looks like it was deprecated in version3.
The recommended way to do this is fairly complex I think. http://lostechies.com/joshuaflanagan/2009/07/13/how-we-handle-application-configuration/
A quick workaround would be to just create a variable called settings and is the Is method.
var settings = ConfigurationManager.AppSettings;
x.For<ISearchStatsProvider>().Use<SearchStatsProvider>()
.Ctor<string>("solrUrl").Is(settings["SolrUrl"]);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With