Hello,
I'm using EF v1. I have following tables:
CREATE TABLE category (
category_id int ,
category_name varchar(100) not null,
CONSTRAINT PRIMARY KEY (category_id)
)
CREATE TABLE categoryDetails (
detail_id int,
category_desc varchar(100) not null,
category_id int NOT NULL,
CONSTRAINT PRIMARY KEY (detail_id),
CONSTRAINT FOREIGN KEY (category_id) REFERENCES category(category_id)
)
A 'category' can have 0..1 'categoryDetails'.
In EF model generated out of above database, EF models the relationship as * both in SSDL and CSDL. Using designer, CSDL, in I can change relationship/association to 0..1 from *. But on checking SSDL it remain as *. On changing it to 0..1 in SSDL, I get error:
"Multiplicity is not valid in Role R111 in relationship RL111. Because the Dependent Role properties are not the key properties, the upper bound of the multiplicity of the Dependent Role must be *."
Please tell how to change SSDL ?
In this case (0..1 in CSDL and * in SSDL) the partial classes are created for code as per 0..1 relationship (i.e. a single reference property in each class, containing a type of the other class - no collection involved). On running code, it runs with no errors. Is this correct (different multiplicity in SSDL and CSDL)?
For cases where table structure can NOT be changed, what is the solution to get 0..1 association ?
Thank You.