Linq-to-Entities - can I reference the many-to-many link table directly?
I have a many-to-many table linking the User and Company table, it also holds a BIT value IsApproved - but L2E is not allowing me to access that value - is there any way to get this value easily? Thank y开发者_开发知识库ou.
Link Table:
CREATE TABLE UserCompany
(
UserId UNIQUEIDENTIFIER NOT NULL REFERENCES User(Id),
CompanyId UNIQUEIDENTIFIER NOT NULL FOREIGN KEY REFERENCES Company(Id),
IsApproved BIT NOT NULL DEFAULT 0,
CONSTRAINT PK PRIMARY KEY (UserId, CompanyId)
)
I think your EDMX model is not updated: you'll have the UserCompany as a separate entity because it contains a column besides the foreign keys.
Please try the following:
- Check out that the connection string is pointing to correct database
- Delete the relationship and update model from database
精彩评论