In my database, there is one large "code" table with system code look-ups for values used all over the system. Like so:
[TableName("code_entries")] public class Code {
[MapField("code_nbr")][PrimaryKey, Identity] public int Id;
[MapField("code")] public string Value;
}
I am new to BLToolkit, and am hoping that there is a concept similar to the static Mappings I have seen, but that will allow me to easily map occurrences of these codes in other tables to their respective values. For instance:
[TableName("person")] public class Person {
[MapField("person_nbr")][PrimaryKey, Identity] public int Id;
[MapField("dob")][Nullable] public int BirthDate;
[MapField("eye_color")][Nullable] public int EyeColorCode;
[MapField("hair_color")][Nullable] public int HairColorCode;
}
If EyeColorCode and HairColorCode above map to values in the Codes table, can I create an easy way to map that data within the OR classes and obtain the whole object in a single query?
I'd like to end up with something like:
// person.Id = 1
// person.DOB = some date
// person.EyeColor = "Blue"
// person.HairColor = "Brown"