如何从实体框架关联获取列名称
我有一个使用设计器构建的实体模型。在我的一个表(应用程序)中,我有几个引用相同状态(状态)表的外键。因此,当构建我的关联时,我有几个使用自动索引名称构建的实体对象:
- application_statuses2
- application_statuses3
等。
我正在构建一个“版本历史记录”类型屏幕,并希望能够正确列出“友好名称”对于修改的每一列。例如,我想显示“Destination Status”,而不是“application_statuses2”。如果我可以确定相关关联上的端点列名称,我可以设置正确的显示值。
我可以在设计器中找到实体对象,我什至可以跟踪它引用构建关联的相关外键的位置,但我似乎可以找到概述 enpoint 或列名称的属性。如何确定关联或实体上的列名称或端点?
I have an entity model built using the designer. In one of my tables (application), I have several foreign keys that reference the same status (status) table. As a result, when my associations were built, I have several entity objects built with an auto indexing name:
- application_statuses2
- application_statuses3
etc.
I'm building a "version history" type screen and want to be able to properly list the "friendly name" for each column modified. For example, I want to display "Destination Status" will be displayed instead of "application_statuses2". If I can determine the endpoint column name on the association in question, I can setup the proper display value.
I can find the entity object in the designer, I can even track where it references the foreign key in question that built the association, but I can seem to find the property that outlines the enpoints or column names. How do I determine the column name, or endpoint, on my association, or entity?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我希望它更容易拿到手,我也一直在寻找它。当同一张桌子有多个 FK 时会有点痛苦。
不知道是否有更好的方法来做到这一点,但我当然希望如此!
I wish it were more ready to hand, have been looking for it as well. Bit of a pain when you have multiple FKs to the same table.
Dont know if there is a better way of doing this, but I certainly hope so!