flaithbheartaigh / dynamic-delivery-4-tridion

Automatically exported from code.google.com/p/dynamic-delivery-4-tridion
Other
0 stars 0 forks source link

Possible "noob" problem! #27

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
I may have this totally wrong but I thought I'd flag it just in case.

I noticed that the PublicationId was not being passed down into the 
PageProvider - this seemed to be causing an error for me:

The GetContentByUrl in the 2011 SP1 page provider tests "if (this.PublicationId 
!= 0)" and adds the PublicationCriteria to the query if false. 

However as the PageFactory never passes PublicationId into the PageProvider, 
this test never passes, so the PublicationCriteria is never added to the 
criteria.

In my case I had two publications one parent - id 10, one inheriting child - id 
35. A page in the parent, published to *both* the parent and child, when 
requested in the child pub always returned the parents page XML as the query 
tries to find the page by the url alone (because the PublicationCriteria wasn't 
added) and this presumably returned two hits - one for pub 10 and one for pub 
35, defaulting to the first record I presume - pub 10's XML.

Have I totally mis-understood? 
I added "PageProvider.PublicationId = PublicationId;" in the PageFactory and 
everything appeared to work correctly.

Original issue reported on code.google.com by gibbon...@gmail.com on 1 Mar 2012 at 4:24

GoogleCodeExporter commented 8 years ago
OK - think I see.
The sample project uses Unity to set the publication on the object that 
implements IPageProvider. This is set up in the web.config mapping of 
implementations to interfaces.

As we aren't initially using DI the value wasn't being set.

Cheers

Original comment by gibbon...@gmail.com on 5 Mar 2012 at 9:42

GoogleCodeExporter commented 8 years ago

Original comment by quirijn....@gmail.com on 31 Mar 2014 at 7:25