Many-To-Many Relationship in Code-First EF4

前端 未结 2 1854
情歌与酒
情歌与酒 2020-12-29 13:53

How do you represent a many-to-many relationship in the EF4 Code-First CTP3?

For example if I have the following classes:

class User
{
    public int         


        
2条回答
  •  隐瞒了意图╮
    2020-12-29 14:32

    EDIT: CTP4 was released late yesterday (July 14 2010) and there is now support for this:

    modelBuilder.Entity().HasMany(p => p.Tags).WithMany();


    I found out finally that this currently isn't possible. Microsoft is looking to add this feature (only one navigation property).

    See this link on the MSDN forums for more information: http://social.msdn.microsoft.com/Forums/en/adonetefx/thread/6920db2b-88c7-4bea-ac89-4809882cff8f

提交回复
热议问题