In R2 there is a limitation in our built in Property of type Page (PropertyPageReference) which is that it stores the value in database as an integer (which also is a foreign key to tblPage). In R3 this will be addressed so the prorperty stores the PageGuid in db instead (meaning it will work for "custom" pages as well).
To get it to work in R2 however you can create a custom Property class that inherits e.g. PropertyString and stores the references page as a guid (instead of an int). You can probably override control EPiServer.Web.PropertyControls.PropertyPageReferenceControl to create a control that renders your custom property. You have to override property PageLink in PropertyPageReferenceControl.
I'm still working on my custom page provider to provide access to an outside data source.
I've got the items in my repository listed in EpiServer edit mode and can categorise them according to some arbitrary scheme. However I want content editors to be able to use this as a sort of browser for data. So I need to either allow them to publish my virtual pages - which makes it difficult for them to find again (we have about 10,000-20000 items) or create a page that can contain one of my virtual pages.
I tried the latter and got the following error:
The INSERT statement conflicted with the FOREIGN KEY constraint
"FK_tblWorkProperty_tblPage". The conflict occurred in database
"dbMediaIntegration", table "dbo.tblPage", column 'pkID'.
Description: An unhandled exception occurred during the execution of the current
web request. Please review the stack trace for more information about the error
and where it originated in the code.
Exception Details: System.Data.SqlClient.SqlException: The INSERT statement
conflicted with the FOREIGN KEY constraint "FK_tblWorkProperty_tblPage". The
conflict occurred in database "dbMediaIntegration", table "dbo.tblPage", column 'pkID'.
This is because the page link id's are coming from my custom provider and so don't exist in EpiServer's database.
What's the best way to get the functionality I need? I'm having trouble getting publish to work as well.