Vulnerability in EPiServer.Forms
I am using the below in episerver 6 R2 , to get page data
PageData page = Global.EPDataFactory.GetPage(new PageReference(ErrorPageID));
What class i can use in Episerver 7 , as EPDataFactory is no more available
var contentrepo = ServiceLocator.Current.GetInstance<IContentRepository>();var content = contentrepo .Get<IContent>(contentReference);
using dependecy injection for getting IContentRepository preferred :)
Nope. Not that one. It will return a single content item. If you want a list of items below the node you can use .GetChildren() instead.
If you already know you have a page (not an image or block etc) you can instead use
var page= contentrepo .Get<PageData>(contentReference);
After that it's pretty similar to Episerver 6. You can check propeties etc.
DataFactory can still be used in CMS 11.13.x (latest version). Based on the name EPDataFactory it sounds like it is a custom wrapper in your code, or a 3rd party library.
But yes, using IContentRepository in a constructor injection way as Daniel suggested is the best way to move forward.