OneToOne relation (cardinality) in LINQ to SQL with SQLMetal

1.4k Views Asked by At

Is there any possibility to set OneToOne relation (cardinality) when generate dbml with SQLMetal? By default dbml schema generated with the OneToMany relation.

2

There are 2 best solutions below

1
On

I use SqlMetal to produce a Dbml file, and then i use a xslt to modify the content of it(using this xslt base: http://blogs.msdn.com/ploeh/archive/2008/04/10/AutomaticallyGeneratingLINQToSQLModelsFromTSQL.aspx), eg. changing the cardinality or changes the type for Enums.

3
On

Are you using the DBML designer? If so you should be able to right-click the arrow that represents the relationship and select Properties. The Cardinality property can then be set in the properties dialog to OneToOne.