Hi,
it's quite surprising, really, but I just had the first situation where I wanted to model a 0...n relation between two tables, and couldn't do it.
At first I tried creating a 1...n relation and checked the 'Nullable' checkbox on the foreign key, but that doesn't work (I get a .NET exception telling me that a conversion between In32 and Nullable<uint> did not succeed, no stacktrace.).
I then decided to search around but couldn't find any option or button or anything to do this.
Does Linq2SQL only support 1..n/n..m/1..1 relations between tables?
How can I model a 0...n relationship between two tables?
Re: How can I model a 0...n relationship between two tables?
Please set the same type (int or uint) on both sides of your association. If this doesn't help, send us a small test project and specify the steps we should follow for reproducing.steffen_w wrote:At first I tried creating a 1...n relation and checked the 'Nullable' checkbox on the foreign key, but that doesn't work (I get a .NET exception telling me that a conversion between In32 and Nullable<uint> did not succeed, no stacktrace.).
Re: How can I model a 0...n relationship between two tables?
Both sides were set to uint, but the foreign key was a nullable<uint>.
Just for clarification: Are you saying that a 0..n relationship between two tables is supported?
Just for clarification: Are you saying that a 0..n relationship between two tables is supported?
Re: How can I model a 0...n relationship between two tables?
For the OneToMany association, you can implement the following scenarios:
nullable<uint> -> nullable<uint>
uint -> uint
The nullable<uint> -> uint way is not supported.
nullable<uint> -> nullable<uint>
uint -> uint
The nullable<uint> -> uint way is not supported.
Re: How can I model a 0...n relationship between two tables?
uh, could you fix that? I really don't want a nullable primary key...
Re: How can I model a 0...n relationship between two tables?
Could you please send us a small test project with the corresponding DDL/DML script so that we can better understand your approach and recommend you a workaround?