Don't miss out Virtual Happy Hour this Friday (April 26).

Try our conversational search powered by Generative AI!

fredriktjarnberg
Jan 25, 2010
  6894
(1 votes)

Generic overloads of GetPage and GetChildren - To be or not to be?

Joel Abrahamsson put some light on some issues with the newly added generic overloads GetPage and GetChildren on DataFactory as well as the generic overload of ShallowCopy on PageData. These APIs were added mainly to give developers a way to hook in their own PageData implementation in a simple way which was used by the PageTypeTool and was mentioned by Daniel Rodin in his blog post Working with your own PageData types in CMS5 R2 SP2. However, as the use of these methods have been somewhat outdated by the introduction of PageTypeBuilder and as we agree with Joel’s feedback, we are now considering a removal of these APIs by the release of CMS 6.

Our only remaining concern is backward compatibility which is something we struggle to maintain as much as possible (even if we are shipping a new major version).  However our qualified guess (after all we can only guess) is that the adoption of these methods are not that widely spread. If we also take into account that we can create extension methods that replaces all but one of the APIs planned to be cut we think it should be rather safe to get rid of the methods in CMS 6. If you disagree, continue reading.

The signatures that are at stake:

On EPiServer.DataFactory:

public IEnumerable<T> GetChildren<T>(PageReference pageLink)
where T: PageData, new();

public IEnumerable<T> GetChildren<T>(PageReference pageLink, ILanguageSelector selector)
where T: PageData, new();

public T GetPage<T>(PageReference pageLink)
where T: PageData, new();

public T GetPage<T>(PageReference pageLink, ILanguageSelector selector)
where T: PageData, new();

On EPiServer.Core.PageData:

public static T ShallowCopy<T>(PageData copy)
where T: PageData, new();

 

Objections anyone?

We are now interested to hear if there are anyone that strongly disagrees with the suggested change.

Is there anyone out there that uses the APIs listed above?

If yes, would it be sufficient for you to replace the DataFactory changes with equivalent extension methods with the same signature and same semantics?

Please, post a comment here or drop me a mail (fredrik [dot] tjarnberg [at] episerver [dot] com).

Jan 25, 2010

Comments

Björn Olsson
Björn Olsson Sep 21, 2010 10:33 AM

No objections your honour. Haven't used them myself either. I would prefer some new, optimized and cached methods/ways to retrieve pages filtered by categories and so on. Instead of having to implement this logic on top of EPiServers API. I'm not a huge fan of FindPagesWithCritera, or similar aproaches (spelling?) :)

Sep 21, 2010 10:33 AM

I've used PageTypeBuilder on more-or-less every project since it's release in the summer last year and love working with EPiServer in this way and certainly wouldn't go back.

I personally have got round the issue described by Joel by creating extension methods on the PageData and PageReference objects instead (without going into too much detail). However, I'm fully behind Joel's request to have these superfluous methods removed - they can easily be replaced as you say with some custom extension method code anyhow. It may however come back to bite someone though when they upgrade to 6 - but I guess the release notes will have to cover this :-)

Please login to comment.
Latest blogs
Solving the mystery of high memory usage

Sometimes, my work is easy, the problem could be resolved with one look (when I’m lucky enough to look at where it needs to be looked, just like th...

Quan Mai | Apr 22, 2024 | Syndicated blog

Search & Navigation reporting improvements

From version 16.1.0 there are some updates on the statistics pages: Add pagination to search phrase list Allows choosing a custom date range to get...

Phong | Apr 22, 2024

Optimizely and the never-ending story of the missing globe!

I've worked with Optimizely CMS for 14 years, and there are two things I'm obsessed with: Link validation and the globe that keeps disappearing on...

Tomas Hensrud Gulla | Apr 18, 2024 | Syndicated blog

Visitor Groups Usage Report For Optimizely CMS 12

This add-on offers detailed information on how visitor groups are used and how effective they are within Optimizely CMS. Editors can monitor and...

Adnan Zameer | Apr 18, 2024 | Syndicated blog

Azure AI Language – Abstractive Summarisation in Optimizely CMS

In this article, I show how the abstraction summarisation feature provided by the Azure AI Language platform, can be used within Optimizely CMS to...

Anil Patel | Apr 18, 2024 | Syndicated blog

Fix your Search & Navigation (Find) indexing job, please

Once upon a time, a colleague asked me to look into a customer database with weird spikes in database log usage. (You might start to wonder why I a...

Quan Mai | Apr 17, 2024 | Syndicated blog