World is now on Opti ID! Learn more
AI OnAI Off
World is now on Opti ID! Learn more
The code I found is from this link:
http://sdkbeta.episerver.com/SDK-html-Container/?path=/SdkDocuments/CMS/7/Knowledge%20Base/Developer%20Guide/Partial%20Routing/News%20partial%20routing%20example.htm&vppRoot=/SdkDocuments//CMS/7/Knowledge%20Base/Developer%20Guide/#Controller
public void Initialize(EPiServer.Framework.Initialization.InitializationEngine context) { var startPage = context.Locate.ContentLoader().Get<PageData>(PageReference.StartPage); //There should be a property on start page that sets the newsContainer page. var partialRouter = new NewsPartialRouter(new NewsContentStore(), startPage["NewsContainer"] as ContentReference); RouteTable.Routes.RegisterPartialRouter<NewsContainer, NewsContent>(partialRouter); NewsContentGenerator.CreateFakeData(); }
Solved it by fetching the ServiceLocationHelper :
var serviceLocationHelper = ServiceLocator.Current.GetInstance<ServiceLocationHelper>();
serviceLocationHelper.ContentLoader()
Hi,
im looking at the Search example at the SDK developer guide : http://sdkbeta.episerver.com/SDK-html-Container/?path=/SdkDocuments/CMS/7/Knowledge%20Base/Developer%20Guide/Search/FullTextSearchCMSIntegration.htm&vppRoot=/SdkDocuments//CMS/7/Knowledge%20Base/Developer%20Guide/
When I am doing a copy/paste of the sample code for searching pages I get error on all the lines with Locate.<something> . I googled and found some code using :
var context = new InitializationEngine();
context.Locate.ContentLoader()
this does however give me an object reference is null error.
What am I doing wrong ?