有没有一种方法来添加额外的字段来在ADO.NET实体框架的关联? [英] Is there a way to add extra fields to an association in the ADO.NET Entity Framework?

查看:154
本文介绍了有没有一种方法来添加额外的字段来在ADO.NET实体框架的关联?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望能够模型,大约有关系的额外细节的许多一对多的关系。例如:

I would like to be able to model a many-to-many relationship that has extra details about the relationship. For example:

Person: int id, String name
Project: int id, String name

ProjectPerson: Person.id, Project.id, String role

每当我创建了EF的 ProjectPerson 的关联,我不能给的作用的属性添加到关联。如果我创建表在我的数据库,然后将其导入到模型中,我失去了额外的属性。

Whenever I create the ProjectPerson association in the EF, I am unable to add the role attribute to the association. If I create the tables in my DB and then import it into the model, I lose the extra properties.

推荐答案

不幸的是,我相信答案是否定的。但是,如果你找到一个巧妙的方法来处理这​​个问题,asside从创建一个新的实体集。让我知道。

Unfortunately I believe the answer is no. But If you find a clever way to handle this, asside from creating a new Entity Set. Let me know.

这篇关于有没有一种方法来添加额外的字段来在ADO.NET实体框架的关联?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆