问题
I have several tables that all reference the same lookup table. Is it generally a good idea to attach the BelongsTo attribute to each table that references a FK from a lookup table? Or should I model the foreign keys as a property and simply link the two tables while constructing my detached criteria?
回答1:
Not sure I understand the question, but if you're asking whether to do this:
[BelongsTo("id_lookup")]
public virtual Lookup Lookup {get;set;}
or this:
[Property("id_lookup")]
public virtual int Lookup {get;set;}
The answer is: use the first one.
来源:https://stackoverflow.com/questions/3303696/mapping-lookup-tables