5

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?

Raif
  • 8,641
  • 13
  • 45
  • 56

1 Answers1

4

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"]);
Vadim Rybak
  • 1,677
  • 20
  • 25