What is a good way to represent reference data in Entity framework?
For example: I normally create two tables in the database
valid_type
valid_type_id int not null,
name varchar(80),
description varchar(255)
valid_value (Note: PK is valid_type_id, valid_value_id)
valid_value_id int not null
valid_type_id int not null,
name varchar(80),
description varchar(255)
These two tables hold all of my reference data.
I then create a table that uses it as
Rule
rule_id int not null,
rule_type_id int not null,
rule_system_id int not null,
value1 varchar(80),
etc
I can then have enums that can be used by EF
public enum ValidTypes
RuleTypes= 0,
SomethingElse = 1,
public enum RuleTypes
QualityControl = 0,
PostProcessing = 1,
etc
So, now what is a good way to represent this in EF code first? would a Table-Per-Hierarchy be a good approach? How would that be represented in the EF classes? as the "base" type"? or the "derived type"?
This has to be a fairly common scenario, but I have not found much on it with my google-fu.