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
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?
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.
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
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.
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
is working on a reply...
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.