Frame.load is obsolete

Vote:
 

I have code below

        public override void  SetDefaultValues(ContentType contentType)
        {
             base.SetDefaultValues(contentType);

            VisibleInMenu = true;
            this[MetaDataProperties.PageTargetFrame] = Frame.Load(0);
            this[MetaDataProperties.PagePeerOrder] = -1;
        }

But it gives warning on line "this[MetaDataProperties.PageTargetFrame] = Frame.Load(0);" .

It says "Frame.Load(int)' is obsolete: 'Use IFrameRepository instead'

I am not able to find exact replacement for this. Anyone has idea?

#174072
Jan 17, 2017 20:04
Vote:
 

Hi Kiran,

Try this:

public override void SetDefaultValues(ContentType contentType)        
{
     base.SetDefaultValues(contentType);
     var frameRepo = ServiceLocator.Current.GetInstance<IFrameRepository>();

     VisibleInMenu = true;
     this[MetaDataProperties.PageTargetFrame] = frameRepo.Load(0);
     this[MetaDataProperties.PagePeerOrder] = -1;
}

Hope this helps!

Cheers,

John

#174074
Edited, Jan 17, 2017 21:56
Vote:
 
<p></p> <p>Thanks it worked. Is there any replacement for subscriptionList?&nbsp; I dont understand why there are no good documents when things are getting obsolete in newer version. Why they dont provide alternatives?</p> <p></p>
#174083
Jan 18, 2017 10:22
Vote:
 

Hi Kiran,

Do you have a code sample for what you are using subscriptionList on? As for the documentation fixes for obsolete things, I think that it would just be a ton of work to try and maintain something like that. Episerver does give really good documentation on their API's, so you really have to dig through thse to figure out how to use the recommended obsolete fixes. For me, I spend a lot of time in Visual Studio right-clicking on Episerver classes and going to the definition to see how things work. I also did the Episerver advanced development training, which helped a lot in getting up to speed with the CMS API's.

-John

#174104
Jan 18, 2017 19:23
Vote:
 

Its declared like

protected EPiServer.Web.WebControls.SubscriptionList SubscriptionList;

and its used like

SubscriptionList.DataBind();
#174108
Jan 18, 2017 23:27
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.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.