views:

29

answers:

1

I have a OneToMany relationship in an SQL Server database.

When I add the tables to my Linq to SQL diagram (DBML) the relationship comes up as OneToOne.

I have other OneToMany relationships which synchronise correctly.

Even If I change the cardinality to OneToMany the collection still only returns a single entity.

Could this be a bug?

Update

I changed the name of the child table and Linq to SQL picked it up correctly as OneToMany.

However, when I change the name back it picks it up as OneToOne again.

Must be a bug. Seems like something is getting cached incorrectly.

I've been refreshing the tables every time I update the DBML.

A: 

Removed the database (.MDF file) from the project and re-added it.

Re-added the relationship to the DBML diagram and it appeared correctly as OneToMany.

Must be a bug. Seems like Visual Studio isn't refreshing the relationships correctly.

Robert Morgan