开发者

How to store one entity class in another in specific relation between tables?

开发者 https://www.devze.com 2023-02-26 20:52 出处:网络
I have these relations in my data base: I need all authors related to my 开发者_如何学Pythonbook stored in book entity class?

I have these relations in my data base:

How to store one entity class in another in specific relation between tables?

I need all authors related to my 开发者_如何学Pythonbook stored in book entity class? I was trying to resolve this by using entityset but I can't use it because there is no primary key in BookAuthors table!

Any kind of help will be great! =)


LINQ-to-SQL requires a primary key in order for it to materialize entities. And since neither Books nor Authors entities know anything about each other, I think your only option is to add a PK to BookAuthors as Pleun mentioned.

This question is very similar to yours, but note the PK on the Order_Detail table: Problem with Linq2Sql Many-to-Many relationship & Inserting new objects.

0

精彩评论

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