Populating a tree recursively with database contents
I am using an [ORM that uses POCOs](https://github.com/ServiceStack/ServiceStack.OrmLite).

Each table (class) contains references to other tables.

	public class Table1 {
		[AutoIncrement]
		public Int32 Id { get; set; }
		[Index(Unique = true)]
		public string FieldA { get; set; }
	}

	public Table2 {
		[AutoIncrement]
		public Int32 Id { get; set; }
		[Index(Unique = true)]
		public Table1 FieldA { get; set; }
		public int FieldB { get; set; }
	}

	public Table3 {
		[AutoIncrement]
		public Int32 Id { get; set; }
		[Index(Unique = true)]
		public List<Table2> FieldA { get; set; }
		[References(typeof(Table2))]
		public int Table2_id { get; set; }
	}

**How would I populate a tree of Table3 which unrolls the referenced Table2 and subsequent Table1 into subtrees?**

Thanks for all suggestions
Populating a tree recursively with database contents
===

I am using an [ORM that uses POCOs](https://github.com/ServiceStack/ServiceStack.OrmLite).

Each table (class) contains references to other tables.

	public class Table1 {
		[AutoIncrement]
		public Int32 Id { get; set; }
		[Index(Unique = true)]
		public string FieldA { get; set; }
	}

	public Table2 {
		[AutoIncrement]
		public Int32 Id { get; set; }
		[Index(Unique = true)]
		public Table1 FieldA { get; set; }
		public int FieldB { get; set; }
	}

	public Table3 {
		[AutoIncrement]
		public Int32 Id { get; set; }
		[Index(Unique = true)]
		public List<Table2> FieldA { get; set; }
		[References(typeof(Table2))]
		public int Table2_id { get; set; }
	}

**How would I populate a tree of Table3 which unrolls the referenced Table2 and subsequent Table1 into subtrees?**

Thanks for all suggestions