Copied to clipboard

Flag this post as spam?

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


  • tasty_spider_men 1 post 21 karma points
    Jul 06, 2010 @ 14:52
    tasty_spider_men
    0

    Issues getting started with Linq to umbraco (children property of doctypebase)

    Hi

    I'm trying to do something as basic as possible to get my feet wet with the linq to umbraco api, but i am having problems and have not been able to find any documentation on use case scenarios besides the aaron powell screencasts.

    I have installed a new 4.5 umbraco, added a doctype with a single textstring property and created a single node in the tree with two children (of same doctype).

    It is my expectation that i am able to grab the first node and use the children property to access its ... children. I am confirming my ability to grab the root node of my tree by response.writing its title.

    As i attempt to now access its .Children collection, i get the following exception

    [KeyNotFoundException: The given key was not present in the dictionary.]
       System.Collections.Generic.Dictionary`2.get_Item(TKey key) +12681071
       umbraco.Linq.Core.Node.<DynamicNodeCreation>d__6.MoveNext() +594
       System.Linq.Enumerable.Count(IEnumerable`1 source) +267
       masterpages_Root.Page_Load(Object sender, EventArgs e) +228
       System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +25
       System.Web.UI.Control.LoadRecursive() +71
       System.Web.UI.Control.LoadRecursive() +190
       System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3048

    Accessing the children property of any one of these entities throws the above exception.

    Am i wrong in expecting to be using these entities/doctypebases as nodes? I was hoping to be able to have a smoother api for querying my tree (other than the usual extension-methods ive been using for a while).

    Should i regard linq to umbraco only for scenarios of content querying where tree heirarchy is not part of the picture?

  • hard_life 6 posts 3 karma points
    Nov 03, 2010 @ 09:04
    hard_life
    0

    Hi,

    Sadly noone ever replied to this post. Anyone got a clue?

    I have since, only because I forgot I ever had a problem with this, attempted to use Linq 2 Umbraco again, only to experience the same problem. It has occured to have however, that it occurs with any kind of association (NodeAssociationTree).

    It feels strange that upon searching, noone has ever had an issue with this, when i cant do any kind of nodeassociations. Is this not supported or what?

    ps: old post written on an account i cant remember.

Please Sign in or register to post replies

Write your reply to:

Draft