London Dev Meetup Rescheduled! Due to unavoidable reasons, the event has been moved to 21st May. Speakers remain the same—any changes will be communicated. Seats are limited—register here to secure your spot!
London Dev Meetup Rescheduled! Due to unavoidable reasons, the event has been moved to 21st May. Speakers remain the same—any changes will be communicated. Seats are limited—register here to secure your spot!
Hi Daniel,
The Locate is a instance of the ServiceLocator and is a property inherited from the PageBase class I think.
Hi Daniel
I don't see what part is in bold but I was able to get the code from the EPiServer 7 CMS Documentation to work by replacing
ContentSearchHandler contentSearchHandler = Locate.ContentSearchHandler();
with
var serviceLocationHelper = ServiceLocator.Current.GetInstance<ServiceLocationHelper>();
var contentSearchHandler = serviceLocationHelper.ContentSearchHandler();
Hi,
In addition, instead of locating the ServiceLocationHelper, which is a class that contains common shortcuts to the ServiceLocator, and retrieving the search handler from there, you can fetch the search handler directly from the ServiceLocator:
var contentSearchHandler = ServiceLocator.Current.GetInstance<ContentSearchHandler>();
I have copy pasted following code from the EPiServer 7 CMS SDK Documentation: