p.WasPublished vs ThatArePublished()
Hi there.
Could someone explain the difference between the following 2 Fluent API methods?
App.WorkWith().
Pages().
LocatedIn(Telerik.Sitefinity.Fluent.Pages.PageLocation.Frontend).
Where(p => p.WasPublished ==
true
).
Get().
ToList();
App.WorkWith().
Pages().
LocatedIn(Telerik.Sitefinity.Fluent.Pages.PageLocation.Frontend).
ThatArePublished().
Get().
ToList();
Hi,
WasPublished is property of the PageNode object. ThatArePublished is part of PagesFacade.
ThatArePublished has an overload that allows you to pass the culture, so the method will filter by it.
ThatArePublished filters by two parameters - all page nodes that are visible and their version is greater that 0.
The property does not allow you to specify culture and it does not checks for visibility.
Kind regards,
Ivan Dimitrov
the Telerik team
Thanks Yvan.
Makes sense now:)
Hi,
did you change the behaviour of ThatArePublished() from version 4.4 to 5.1?
This used to work in 4.4:
App.WorkWith().Pages().LocatedIn(Telerik.Sitefinity.Fluent.Pages.PageLocation.Frontend).ThatArePublished(Thread.CurrentThread.CurrentCulture).Where(p => p.ShowInNavigation ==
true
).OrderBy(p => p.Ordinal).Get()
App.WorkWith().Pages().LocatedIn(Telerik.Sitefinity.Fluent.Pages.PageLocation.Frontend).ThatAreForLanguage(Thread.CurrentThread.CurrentCulture).Where(p => (p.ApprovalWorkflowState ==
"Published"
|| p.ApprovalWorkflowState ==
""
) && p.ShowInNavigation ==
true
).OrderBy(p => p.Ordinal).Get();