开发者

How to access Link table (2 associations, 2 primary foreign key) In Entity Framework 4 database generated edmx file

开发者 https://www.devze.com 2023-02-04 19:11 出处:网络
I have 2 tables: User (UserID, UserName) Books (BookID, BookName) Each user can hold many books, each book can be hold by many users.

I have 2 tables:

User (UserID, UserName)

Books (BookID, BookName)

Each user can hold many books, each book can be hold by many users.

so there is a link table:

UserBook (PFK UserID, PFK BookID).

I've generated a Model using EF4, and I can see the association in the Model, but I can't see User.UserBook,开发者_如何学C nor Book.UserBook. and no UserBook object as well.

how can I query this table ? add items ? etc... ?


User has Books collection, Books has User Collection, Missed that. Idea came through :

this article

0

精彩评论

暂无评论...
验证码 换一张
取 消