如何使用 EF4 Code First 对同一个表进行多对多操作
我有这个架构:
create table Person
(
id int identity primary key,
name nvarchar(30)
)
create table PersonPersons
(
PersonId references Person(id),
ChildPersonId references Person(id)
)
如何创建类以使用 EF4 Code First CTP5 映射它们?
I have this schema:
create table Person
(
id int identity primary key,
name nvarchar(30)
)
create table PersonPersons
(
PersonId references Person(id),
ChildPersonId references Person(id)
)
how to create the classes to map them using EF4 Code First CTP5 ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
对于 POCO...
...在 DbContext 中设置映射...
...将为您提供默认实现。如果您需要显式重命名表(并且想要多对多关系),请添加类似这样的内容...
For the POCO...
...set up the mapping in the DbContext...
...will give you a default implementation. If you need to rename the table explicitly (and want a many-to-many relationship), add in something like this...