Can anybody give me a propper tutorial on how to add associations to an EDM model which is based on a database without foreign keys?
I've been looking around, but I can't find anything up to date for EF4.
Can anybody give me a propper tutorial on how to add associations to an EDM model which is based on a database without foreign keys?
I've been looking around, but I can't find anything up to date for EF4.
Thanks in advance,
- Yannick
Is the database contains PK? if not I am afraid you can't do that because
SQL is RelationShip DB not the same as Access DB.
Can anybody give me a propper tutorial on how to add associations to an EDM model which is based on a database without foreign keys?
I've been looking around, but I can't find anything up to date for EF4.
Thanks in advance,
- Yannick
I'm afraid you cannot do that……Well,what you can do is just to set relationship between tables in the SQL Server and then import these tables into the database,And the relationship will be automatically created。That'd be what you want。
Yannick86
Member
565 Points
366 Posts
EF4 No foreign keys - map associations
Feb 13, 2012 11:32 AM|LINK
Heya guys,
Can anybody give me a propper tutorial on how to add associations to an EDM model which is based on a database without foreign keys?
I've been looking around, but I can't find anything up to date for EF4.
Thanks in advance,
- Yannick
thaicarrot
Contributor
5433 Points
1508 Posts
Re: EF4 No foreign keys - map associations
Feb 13, 2012 03:40 PM|LINK
Is the database contains PK? if not I am afraid you can't do that because SQL is RelationShip DB not the same as Access DB.
Weera
Decker Dong ...
All-Star
118619 Points
18779 Posts
Re: EF4 No foreign keys - map associations
Feb 15, 2012 12:35 AM|LINK
I'm afraid you cannot do that……Well,what you can do is just to set relationship between tables in the SQL Server and then import these tables into the database,And the relationship will be automatically created。That'd be what you want。
Reguards!
Yannick86
Member
565 Points
366 Posts
Re: EF4 No foreign keys - map associations
Feb 15, 2012 11:27 AM|LINK
Did some research and it's perfectly possible by modifying the EDM.
Found it on Julia Lerman her blog + in her book:
http://thedatafarm.com/blog/data-access/mapping-associations-in-the-edm-designer/
thaicarrot
Contributor
5433 Points
1508 Posts
Re: EF4 No foreign keys - map associations
Feb 15, 2012 11:31 AM|LINK
I wonder. Did you add PK at DB? Just curious to know.
Weera
Yannick86
Member
565 Points
366 Posts
Re: EF4 No foreign keys - map associations
Feb 16, 2012 08:30 AM|LINK
Hey,
Like I said there were no FK's, allthough I never did say anything about PK's ... well, there are PK's.
regards,
- Yannick