Jon Kruger

I've been working with LINQ to SQL lately and I've had intermittent problems with the LINQ to SQL designer not generating code for associations (one-to-many relationships). If I view the properties for the relationship, everything looks correct. Deleting and re-adding one of the tables doesn't seem to fix the problem. I was able to close Visual Studio, re-open it, and change some stuff in the designer and then it would pick up the change.

Just wondering if this is a known issue and if there is some other way around it... I'm assuming that Visual Studio is caching database information off somewhere and it would be nice if there was a way to force it to recreate everything from scratch.

Jon



Re: LINQ Project General LINQ to SQL designer doesn't generate code for associations

WilliamStacey

Jon Kruger wrote:
I've been working with LINQ to SQL lately and I've had intermittent problems with the LINQ to SQL designer not generating code for associations (one-to-many relationships). If I view the properties for the relationship, everything looks correct. Deleting and re-adding one of the tables doesn't seem to fix the problem. I was able to close Visual Studio, re-open it, and change some stuff in the designer and then it would pick up the change.

Just wondering if this is a known issue and if there is some other way around it... I'm assuming that Visual Studio is caching database information off somewhere and it would be nice if there was a way to force it to recreate everything from scratch.

Jon

You might try deleting both tables from the linq designer and re-adding them. They should be connected by the proper line via your defined sql relationship in the db.





Re: LINQ Project General LINQ to SQL designer doesn't generate code for associations

Jon Kruger

Hopefully this is something that will be fixed, deleting tables from the designer is a pain when you've set up a bunch of properties on the tables.





Re: LINQ Project General LINQ to SQL designer doesn't generate code for associations

Dinesh Kulkarni - MSFT

Jon,

Just to rule out the obvious - have you saved after adding a table or association I have not been able to repro this with beta2 so I don't know anything obvious but I will ask other team members.


Thanks,
Dinesh






Re: LINQ Project General LINQ to SQL designer doesn't generate code for associations

Jon Kruger

I've tried everything... saving, making changes and closing the file, rebuilding, etc.





Re: LINQ Project General LINQ to SQL designer doesn't generate code for associations

starskythehutch

I'm having this problem with the RTM of 2008 as well.




Re: LINQ Project General LINQ to SQL designer doesn't generate code for associations

starskythehutch

Found the problem.

I was trying to link a table to a view and I didn't give the view a primary key. Add the primary key on the view in the designer and it worked fine.




Re: LINQ Project General LINQ to SQL designer doesn't generate code for associations

Jon Kruger

That's not the original problem that I brought up... I would add a valid association between two tables and it wouldn't generate the code.

I haven't had the problem in awhile, FWIW.