Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Peter Duncanson 430 posts 1358 karma points c-trib
    Mar 30, 2010 @ 17:43
    Peter Duncanson
    0

    Custom Business logic layer?

    I'm wanting to create a layer to allow us to mange our data in one place when rendering it out in the templates. The current examples I see are ok (eg checking for various properties on a node using xpath such as umbracoHideInNav for instance) but its not very DRY or extendable.

    I'm thinking of creating an extention which could allow this logic to be wrapped up in one place. So that you could do something like:

    MyBizLayer.getHouseByID( 1234 ) // returns a node with the XML for the requested id

    MyBizLayer.getHousesByTown( "Huddersfield" ) // returns node list of house ids (or the xml for all the houses?) for all houses in Huddersfield

    MyBizLayer.isHouseOnSale( 1234 )  // returns true/false

    The first is similar to getNodeByID but uses the domain language and can have more checks wrapped around it to ensure its available or similar?

    Anyone been doing anything similar? How have you been doing it if so? I'm pondering a c# extension dll would be the best way to go but a file of XSL templates that I can call might do it too?

    Cheers

    Pete

  • Lee Kelleher 3945 posts 15163 karma points MVP 10x admin c-trib
    Mar 30, 2010 @ 18:12
    Lee Kelleher
    0

    Hi Peter,

    Definitely separate out the business logic into it's own .NET class library - exposing various methods as XSLT extensions.  Main reasons would be that it is easier to debug/maintain, (re-usability), and make use of various caching facilities in the .NET framework.

    To get your started, take a look at Hendy's Umbraco Helper Class.  It's a good basis for working with Node and XPathNodeIterator objects.

    Having a set of XSLT templates would work, but depends on your dev team, what they are most comfortable working with, etc.

    Cheers, Lee.

  • Aaron Powell 1708 posts 3044 karma points c-trib
    Mar 30, 2010 @ 23:40
    Aaron Powell
    0

    We only use a custom business logic layer, every single one of our front end files are dumb.

    Check out this blog post by Shannon on how we do it - http://www.farmcode.org/post/2009/02/24/Linq-to-Umbraco.aspx

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies