Does the Page ID for a page displayed via a Page Provider have to be unique.
e.g. if I have a blank site, and I create the initial start page the ID assigned to this page is 3. Can I then have a page beneath this start page provided by a custom page provider with the page ID of 3 ?
If not, then no matter what page ID I assign to my page provider pages (e.g. I could start them at 10,000) eventually I will get page ID conflicts.
How have other addressed this when using page providers ?
A Page ID only have to be unique within a page provider, so you can have two page providers delivering Page ID 3. The identifier of a page is passed using the PageReference class which holds information on where the ID belongs (and converts to and from a string as well).
You could ofcourse offset your ID with a few millions anyway to protect you against bugs in the templates during development (if someone tries to access a page using the raw integer value you get a page not found exception instead of the wrong page which may pass unnoticed).
As Per says, page IDs only have to be unique within a provider - it's the PageReference which is unique across the site.
Never work directly with page IDs in your code - if you always work with PageReference objects then you won't get any conflicts. The ConstructPageReference() helper method in the page provider base class allows you to format PageReference values properly for your provider.