Issue with upgrade to Epi 11 aroud Page Refernces

Vote:
 

We're working to upgrade Epi 10 CMS to 11. We have alot of code like below.

When we run the site, landingPageConfig.GetLandingPageReference("AccessRequestForm"); now comes back NULL without any other changes to the site code, for the most part.

Where there big changes in Content Loading that we should know about?

        public Guid AccessRequestFormGuid
        {
            get
            {
                var landingPageConfig = ServiceLocator.Current.GetInstance<Business.ContentConfiguration.ILandingPageConfiguration>();
                var contentLoader = ServiceLocator.Current.GetInstance<IContentLoader>();
                var accessRequestFormReference = landingPageConfig.GetLandingPageReference("AccessRequestForm");
                var requestPageData = contentLoader.Get<StandardPage>(accessRequestFormReference);
                var formBlock = contentLoader.GetItems(requestPageData.MainContentArea.Items.Select(i => i.ContentLink), new LoaderOptions { LanguageLoaderOption.FallbackWithMaster() }).OfType<FormContainerBlock>().FirstOrDefault();

                return formBlock.Content.ContentGuid;
            }
        }

#199615
Dec 03, 2018 21:48
Vote:
 

Hi Paul

You can review any breaking changes for CMS 11 here: https://world.episerver.com/documentation/upgrading/Episerver-CMS/cms-11/breaking-changes-cms-11/

Its probably worth looking at the implementation of Business.ContentConfiguration.ILandingPageConfiguration as this is not an Episerver component so see what this is doing and see why its returning null. The IContentLoader implementation doesn't appear to be being used as part of landingPageConfig in the code you have pasted in.

David

#199617
Dec 03, 2018 23:02
Vote:
 

Hey David, thanks for the answer.

We think it stems from a change in behavior of StructureMap. Once we constructed this class directly, the problem was gone!

#199700
Dec 06, 2018 16:19
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.