Copied to clipboard

Flag this post as spam?

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


  • Laurent Lequenne 120 posts 245 karma points
    May 16, 2011 @ 10:55
    Laurent Lequenne
    0

    DynamicNodeContext

    Is there a way to use the DynamicNodeContext in a classic .NET class ? I would like to get the rid of Umbraco.Linq that seems to me a bit heavy with using DynamicNodes.

    But I guess there are some issues with it. I created such a class. So I can access the Model. But I don't know if this is enough or I should do it another way.  I have to override some Execute function fom the DynamicNodeContext, but no Idea what it has to do.

     

     

    public sealed class DynamicDataContextProvider : DynamicNodeContext

    {

     

     

     

     

     

     

     

     

     

     

     

    public DynamicNode GetHomeSiteByRef(string  reference)

    {

     

     

         return Model.XPath("\\HomePage[reference' = '" + reference + "'").FirstOrDefault();

    }

     

     

    public DynamicNode GetHomeSite(int nodeId)

    {

     

     

    DynamicNode node = new DynamicNode nodeId);

     

    return node.AncestorOrSelf("HomePage");

    }

    }

  • 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