Lets say I have two tables, Users and UserInformation. I'd like to create an association or navigation property, not sure which is the right term, between the two. However, my DB does not contain a foreign key and my dba doesn't want to put one on it, for whatever reason.
How do I setup a relationship between my two entities? It would be a 1 to 0..1, joined on UserID. I've tried using the GUI and every time I go to run the code, I get an error:
error 3027: No mapping specified for the following EntitySet/AssociationSet - UserUserInformation.
What am I doing wrong?开发者_开发知识库
Given tables like this:
create table [User](ID int, UserName varchar(80) PRIMARY KEY(ID))
create table UserInfo(ID int, UserID int NOT NULL, UserData varchar(80) PRIMARY KEY(ID))
You create the association, one to many between Users and UserInfo then in the associations properties you add a referential constraint with Users as the principal, ID as the principal key and UserID as the dependent property key.
精彩评论