Mapping lookup tables

情到浓时终转凉″ 提交于 2019-12-11 02:02:18

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!