CodeSmith Community
Your Code. Your Way. Faster!

DeepLoad Stack Overflow Error in NetTiers 2.0.1.449

Latest post 02-28-2007 8:07 PM by RyanHaney. 1 replies.
  • 02-28-2007 5:09 PM

    • RyanHaney
    • Not Ranked
    • Joined on 02-28-2007
    • Posts 8
    • Points 100

    DeepLoad Stack Overflow Error in NetTiers 2.0.1.449

    I am trying to deep load an entity in my solution for display on a web page.  Ideally I would like to use the deeploadbyvideoid function, but I cannot without getting an exception.

    My "object graph" is as follows:

    Video
    --Director
    --Studio
    --Country
    --TList<Scenes>
    ----TList<Stars>
    ----TList<Extra>

     I call the videoService.DeepLoadByVideoID function by:

     Video video = videoService.DeepLoadByVideoID(1, true, DeepLoadType.IncludeChildren, typeof(Director), typeof(Studio), typeof(Country), typeof(TList<Scene>), typeof(TList<Stars>), typeof(TList<Extra>);

    I would expect that I could then call video.SceneCollection[0].StarCollection[0].StarName, but a stack overflow occurs during the DeepLoadByVideoID call, in CommonRules.cs on line 104.  The line reads: PropertyInfo p = target.GetType().GetProperty(e.PropertyName);  The method call is StringMaxLength, which is being called recursively in a loop, hence the stack overflow (at least it errored out a few times there on my system).

    If I change the above statement to remove Stars and Extra TList's, the code works for the requested types.  My workaround was to loop through each scene, calling the starService.GetBySceneIDFromSceneStar and extraService.GetBySceneIDFromSceneExtra methods, adding them manually to the current scene.StarCollection and scene.ExtraCollection.

    Is there a problem with the way I am calling the code?

    BTW, thanks for creating such great a great framework!

    Thanks!

    Ryan

     

     

    • Post Points: 5
  • 02-28-2007 8:07 PM In reply to

    • RyanHaney
    • Not Ranked
    • Joined on 02-28-2007
    • Posts 8
    • Points 100

    Re: DeepLoad Stack Overflow Error in NetTiers 2.0.1.449

    I figured out the error - there is a relationship in the objects that causes a circular reference - for example:

    Videos have scenes
    Scenes have Stars
    Stars belong to Scenes

    In other words, the following line of code is possible:

    video.SceneCollection[0].StarCollection_From_SceneStars[0].SceneCollection_From_SceneStars[0];

    Can remove types from the Type[] as they are processed, and store references to them in an array for assignment to the objects later?  Or would that create the same problem?

     -Ryan

    • Post Points: 5
Page 1 of 1 (2 items) | RSS
Copyright © 2008 CodeSmith Tools, LLC
Powered by Community Server (Commercial Edition), by Telligent Systems