I play with LinqToSQL using an existing multilingual database, but I am having problems displaying pretty important one-to-one relationships, so I suspect that I am using this function incorrectly for my database project.
Suppose there are two tables, Category and Category Details. The category contains CategoryId (PK), ParentId and TemplateId. CategoryDetail contains CategoryId (FK), LanguageId, Title and Description (in the corresponding language) with a combined PK CategoryId and LanguageId.
If I drag these tables into the LinqToSQL constructor, the resulting object model has a category with a set of CategoryDetail objects, which should never be. I would like to be able to filter the LanguageId at the DataContext level, which means that the entire Category is encapsulated in Category.CategoryDetail, and not in all language versions encapsulated in Category.CategoryDetails.
This database worked fine on my old object library (regular BOL and DAL for the old school), but I'm afraid LinqToSQL will require this to change to give me the desired result.
What is the best way to make this ratio (and language filtering) as smooth as possible?
source
share