开发者

OneToMany relationship appearing as OneToOne in Linq to SQL diagram

开发者 https://www.devze.com 2022-12-25 16:00 出处:网络
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 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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消