Populating Child ReadOnlyLists

Populating Child ReadOnlyLists

Old forum URL: forums.lhotka.net/forums/t/3200.aspx


devbanana posted on Monday, July 16, 2007

Hello,

 

I have a ThreadList class that executes a stored procedure, GetThreads. It then passes the datareader to each child thread (ThreadInfo), which works just fine so far.

 

But then the ThreadInfo needs to populate a child ThreadUserInfo and ThreadTypeInfo. The top list is only a read only list, but still certain information is required when listing threads, and the user information is one of them.

 

Would you recommend:

  1. have each ThreadInfo execute two more stored procedures, GetUser and GetType. This is my least favorite because it calls then for two queries per thread which is a bit much for a read only list.
  2. Select all the information in the GetThreads stored procedure (probably renaming it GetThreadInfo then because of the differing requirements), and populate the child objects simply by passing the datareader to them.
  3. Same as above, but simply put all the information I need such as type name and user name into the ThreadInfo class, so there are no child objects. This is OK, but if I ever want more information from the user table I'd need to update the query and the business object.

Copyright (c) Marimer LLC