DTO Recursive

Posts   
 
    
tecnocrata avatar
tecnocrata
User
Posts: 9
Joined: 24-May-2007
# Posted on: 15-May-2008 18:24:41   

Hi Is there a way to build a recursive DTO template?

What hell is a recursive DTO template? Well is something I needd.... I have three entity classes (of course the following code is a sample)

class AEntity 
{
  public string Name {get;set;}
  public BEntity ObjectB {get; set;}

}

public BEntity  
{
  public CEntity ObjectC {get; set;}

}

public CEntity  
{
  public AEntity ObjectA {get; set;}
}

But I need a more complex DTO Objects generated like

class A 
{
  public string Name {get;set;}
  public B ObjectB {get; set;}

}

public B 
{
  public C ObjectC {get; set;}

}

public C  
{
  public A ObjectA {get; set;}
}

There are two problems

  1. The current DTO Template (http://www.llblgen.com/tinyforum/Messages.aspx?ThreadID=10504&HighLight=1) only generate a plain Object, not analize the other objects
  2. Like the previous sample, It's posible a recursive references.

What I need?

  1. A sample of code to build this recursive template
  2. How to control the recursive deep?

Why I need that template¿?

  1. For do things like JSON of recursive objects
  2. There area another way to do this?

Thanks

Sorry my english isn't good

Walaa avatar
Walaa
Support Team
Posts: 14987
Joined: 21-Aug-2005
# Posted on: 16-May-2008 11:46:36