views:

22

answers:

2

Hey,

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!

A: 

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)

Sergey Osypchuk
Indeed they do. The link table has a combined PK of TagId and ArticleId
Oskar Kjellin
Do not remember exactly, but COMBINED PK is somthing which worth to avoid in LINQ. for example, here this is accepted answer - http://stackoverflow.com/questions/647146/is-it-beneficial-to-use-multicolumn-composite-primary-keys-when-using-linq-to-s
Sergey Osypchuk
The problem is that I have other combined PK without any problems using LINQ
Oskar Kjellin
+1  A: 

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

Oskar Kjellin
Interesting - great that you found solution
Sergey Osypchuk
@Sergey however seems like restarting visual studio did the charm as well
Oskar Kjellin