I use EF4.
Hope my question is not too trivial:
What is the difference between a Navigation Property and an Association in EF?
If you could give me a simple explanation with an example would be great thanks!
I use EF4.
Hope my question is not too trivial:
What is the difference between a Navigation Property and an Association in EF?
If you could give me a simple explanation with an example would be great thanks!
An association is the definition of a relationship between two entity types (ala a foreign key)
A navigation property really is a property that allows you to traverse from one end of an association to the other.
Edit: Sorry you wanted an example.
Take a look at this MS documentation. It makes it pretty clear the difference.
To blatantly inline their documentation (self hosted the images):
PublishedBy and WrittenBy are associations. They tie together Book/Publisher and Book/Author (ala foreign keys)
Notice Books in the Publisher and Author entities. This "navigation property" allows you to traverse back to the book entity and retrieve it's information as well. (Author.Books.Title for example)
Hope that explains it!
I believe the Association acts as a foreign key while the Navigation Property allows you to "Navigate" between related entities in code.
Foreign Key Association in Entity Framework 4
EDIT
Also, it doesn't look like you can have a Navigation Property without a foreign key (Association) : Navigation Property without Declaring Foreign Key
Navigation properties reflects the relationship between two entities, and the foreign key is one of the ways to define the relationship between two tables or entities in terms of EF.