Wrox Home  
Search P2P Archive for: Go

  Return to Index  

dotnet_windows_app_design thread: Look-Up class design


Message #1 by "Andy Tate" <atate@s...> on Thu, 23 Jan 2003 13:52:47
Hi,

I am looking at creating a new project where I will displaying many 'look-
up' type values - e.g. within combos / lists etc - presented for user 
selection.

Typically, on the database, these values exist within tables comprising of 
just 'code' and 'description' fields

e.g. "Status"; "Category"; "Type" etc.

What I'm wanting to do in my App, is to create a general "LookUp" class - 
where I can hook into the relevant backend table - without having to 
duplicate code etc.

The kinds of methods I'm after are things such as:

GetAll()
GetDescriptionForCode(int code) 
... etc.

Though I'm not sure whether to create an abstract base class and then 
create derived classes for each table type - of maybe just have a single 
class that contains an enum for the types? (I dislike the latter, cos then 
I'd have to involve 'messy' switch statements etc. - and would mean having 
to amend if any new tables were to come along).

Any pointers on this would be greatly appreciated...

Thanks, Andy



  Return to Index