Can I implement foreign keys in Entity Framework 4 on the entity layer?


I have a sizable legacy MS SQL database where foreign key relationships were never implemented.

Is it possible to implement "logical" foreign keys between entities in Entity Framework 4 without there being actual foreign key relationships present in the database?

Yes. In the toolbox, there is "Associations". Just drag from one entity to the other and it will create a "foreign key" for you. Click this association, and go to Properties to change the name and the relationship (1 to Many, Many to Many). Then choose "Mapping Details" to map the columns for this association.