Oskar Kjellin
Oskar Kjellin

Reputation: 21900

Cannot add table to context - LINQ-To-SQL

I'd be happy to give you more info if you need, just ask for it.

I have in my database a table of articles, a table of tags and a link table. The article table has values like Id, Subject etc etc, the tags only have Id and Tag. The link has TagId and ArticleId.

The problem is that when I drag drop the link-table nothing happens! This all worked before I decided to rename my column in the tables from "ID" to "Id" to correct spelling.

Thanks in advance!

Upvotes: 0

Views: 816

Answers (2)

Oskar Kjellin
Oskar Kjellin

Reputation: 21900

The problem was that one of my foreign cas was set to nullable. Unsetting it from nullable made it work!

Upvotes: 1

st78
st78

Reputation: 8316

Please check that all tables has PK on Id column. You are saying that 'The link has TagId and ArticleId.' - For LINQ you need to have single PK - so you need to create fake Primary Key ID (maybe int identity)

Upvotes: 0

Related Questions