More in this section

Forums / Bugs & Issues / Fluent API consistency issues

Fluent API consistency issues

3 posts, 0 answered
  1. Thomas
    Thomas avatar
    223 posts
    Registered:
    19 Jan 2011
    12 Aug 2011
    Link to this post
    Hi,

    I see the SF fluent API lacks consistency.
    For example, to get the published news, you'd do:

    var news = App.WorkWith().NewsItems().Publihed();

    But to get published pages, you'd do:

    var pages = App.WorkWith().Pages().ThatArePublished();

    Another example: I can call First() or FirstThat() on news and other content types, but not on pages (unless I call Get() first).

    So this works:

    var news = App.WorkWith().NewsItems().FirstThat(n => n.UrlName == "something");

    But this doesn't work (missing FirstThat method):

    var page = App.WorkWith().Pages().FirstThat(p => p.UrlName == "something");

    Are there any plans to homogenize these things?

    Thanks.
  2. Lubomir Velkov
    Lubomir Velkov avatar
    688 posts
    Registered:
    03 Nov 2014
    16 Aug 2011
    Link to this post
    Hello Thomas,

    We are aware of these discrepansies and we plan to unify our fluent API in the future. However we cannot give you a strict timeframe. We won't be able to simply rename a method, because that would break a lot of existing code, so we will probably have to create a duplicate method.

    Greetings,
    Lubomir Velkov
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. Thomas
    Thomas avatar
    223 posts
    Registered:
    19 Jan 2011
    16 Aug 2011
    Link to this post
    Hi Lubomir,

    Thanks for the answer. Yes, having duplicate methods is fine. You could just mark some as deprecated, telling programmers to use another method instead (through the Obsolete attribute), so people gradually move to the right methods.
3 posts, 0 answered