AI OnAI Off
The ServiceLocationHelper has some extension methods (in namespace EPiServer I think) that make it easier to get e.g. a content repository. The class is very thin and basically exists only to make it possible to add these extension methods, so it should be cheap to instantiate.
There should be no difference in the container contents between ServiceLocator.Current and context.Locate.Advanced though.
Hi
Maybe mainly question to EPiServer personel but which one we should actually use in initialization modules?
I can see with ILSpy the difference mainly that the context.Locate always does new ServiceLocationHelper(...)
- so if using the context and you need many services then you should get a local scope reference to the ServiceLocationHelper
- and then use that to get the services
- if using the ServiceLocator.Current then you can keep calling that property for all the service requests
But is there any difference which to use?