I have to do a form in which has several comboboxes. Comboboxes have values represented as Key-Description pairs.
Each Combobox has its values in a separate table Key<string>
-Value<string>
How to represent it in a class?
Suppose we have Project (Type and Technology) as "enums", each of them in Type and Technology tables in Database (so its number depends on how many rows in the DB)
class Project {
public int Id {get; set;}
public KeyValuePair<string, string> Type {get; set;}
public KeyValuePair<string, string> Technology {get; set;}
}
or better
class ProjectType { public string Key; public string Value; }
class ProjectTechnology { public string Key; public string Value; }
class Project {
public int Id {get; set;}
public ProjectType Type {get; set;}
public ProjectTechnolgy Technology {get; set;}
}
From the point of view of the separation of concerns probably we should use the second variant, but why to complicate if we could do simple like in the first ?