Linq2Sql Nullable association
In multi-language project I have the following DB structure in SQL2005:
table StringTable:
itemID int PK,
stringID int NOT NULL,
stringValue nvarchar,
languageId int
table Articles:
articleID int PK,
titleID int NOT NULL (FK to StringTable.stringID),
descriptionID int NULL (FK to StringTable.stringID)
I have trouble mapping the Articles.descriptionID->StringTable.s开发者_如何转开发tringID association in Linq2Sql (using the designer).. is says : "The parent property cannot be nullable if the child is nullable"... which I understand... but in my case the descriptionID needs to be nullable. Can anybody help me with this issue or propose a workaround (using L2Sql and C#), I'm open to minor DB structure modifications too if it helps the case.
ps. All I need is a Descriptions property for the Article object which contains the descriptions (in all languages) of the given article or NULL.
Had the same problem - solved by add the association to the other table.
精彩评论