Points to the page provider class and it’s assembly.
This refers to the id of the episerver page that should work as a container for your page provider.
We need to inform episerver which level of functionality our page provider supplies. A list of the different capabilities is available here.
A simple provider
Instead of jumping into the database and fetch the data there I’m going to start with a purely static data version to show the methods discussed above. In this example we have just two pages, a parant page and a child page. Let’s jump straight into the code.
I’ve created a struct to hold my page data (this represents my custom data source) and created two variables (parentPage and childPage) with some bogus data.
1:privatestatic Development.DataAbstraction.SimplePage parentPage = new EPiServer.Development.DataAbstraction.SimplePage()
3: ID = 1000,
4: Guid = Guid.NewGuid(),
5: Name = "Parent page"
8:privatestatic Development.DataAbstraction.SimplePage childPage = new EPiServer.Development.DataAbstraction.SimplePage()
10: ID = 1001,
11: Guid = Guid.NewGuid(),
12: Name = "Child page"
We also create a static reference to the page type we want to work with in this example
In this method we create an instance of a page data object and call this base method called InitializePageData. This method takes a boat load of parameters that among other things are used to map our data to a episerver page type and create an URL Segment (used for the furl of the page) . The last parameter is used in multi language scenarios but since we’re lazy here and work only with one language we can just send in an empty list of strings.
This is also the method in which you map all the other properties to the page data object. For instance if we wanted to populate the MainBody property of the standard page this is we would do it. More on that in a following post.
The method GetSimplePage tries to fetch the page that’s connected to the sent in page link. This method returns a null object if no suitable page is found. We check if the returned object is our null object and if it is we return null. The reason for doing this is that our page provider might be inquired on pages that does not belong to our page provider so we need a way to let episerver know that this request probably is referring to another page provider.
If in fact the page is “ours” we set the guid to the value of the corresponding SimplePage and use a base method to return the Uri.
1:protectedoverride Uri ResolveLocalPage(EPiServer.Core.PageReference pageLink, out Guid guid)
3: var activeSimplePage = GetSimplePage(pageLink);