{"id":172,"date":"2012-09-11T09:50:40","date_gmt":"2012-09-11T07:50:40","guid":{"rendered":"http:\/\/www.ubikuity.net\/blog\/?p=172"},"modified":"2012-09-27T00:18:17","modified_gmt":"2012-09-26T22:18:17","slug":"difference-between-independent-association-and-foreign-key-association-in-entity-framework","status":"publish","type":"post","link":"https:\/\/ubikuity.net\/blog\/2012\/09\/11\/difference-between-independent-association-and-foreign-key-association-in-entity-framework\/","title":{"rendered":"Difference between &#8220;Independent association&#8221; and &#8220;Foreign key association&#8221; in Entity Framework"},"content":{"rendered":"<p>I begin to understand the difference between &#8220;Independent association&#8221; and &#8220;Foreign key association&#8221;\u00a0in Entity Framework Code First thanks to this article : <a href=\"I begin to understand the difference between &quot;Independent association&quot; and &quot;Foreign key association&quot; thanks to this article : http:\/\/www.ladislavmrnka.com\/2011\/05\/foreign-key-vs-independent-associations-in-ef-4\/ Code First: Independent associations vs. Foreign key associations : use both =&gt; This saves on unnecessary DB lookups, allows lazy loaking, and allows you to easily see\/set the ID if you know what you want it to be. Note that having both does not change your table structure in any way. http:\/\/stackoverflow.com\/questions\/5281974\/code-first-independent-associations-vs-foreign-key-associations\">http:\/\/www.ladislavmrnka.com\/2011\/05\/foreign-key-vs-independent-associations-in-ef-4\/<\/a><\/p>\n<p><strong>Advice:<\/strong> use both (Independent associations and Foreign key associations):<\/p>\n<blockquote><p>&#8220;This saves on unnecessary DB lookups, allows lazy loaking, and allows you to easily see\/set the ID if you know what you want it to be. Note that having both does not change your table structure in any way.&#8221;<\/p><\/blockquote>\n<p><strong>Source:<\/strong> <a href=\"http:\/\/stackoverflow.com\/questions\/5281974\/code-first-independent-associations-vs-foreign-key-associations\">http:\/\/stackoverflow.com\/questions\/5281974\/code-first-independent-associations-vs-foreign-key-associations<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>I begin to understand the difference between &#8220;Independent association&#8221; and &#8220;Foreign key association&#8221;\u00a0in Entity Framework Code First thanks to this article : http:\/\/www.ladislavmrnka.com\/2011\/05\/foreign-key-vs-independent-associations-in-ef-4\/ Advice: use both (Independent associations and Foreign key associations): &#8220;This saves on unnecessary DB lookups, allows lazy loaking, and allows you to easily see\/set the ID if you know what you want [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"jetpack_publicize_message":"","jetpack_is_tweetstorm":false,"jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","enabled":false}}},"categories":[42],"tags":[41],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p6emaU-2M","_links":{"self":[{"href":"https:\/\/ubikuity.net\/blog\/wp-json\/wp\/v2\/posts\/172"}],"collection":[{"href":"https:\/\/ubikuity.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ubikuity.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ubikuity.net\/blog\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/ubikuity.net\/blog\/wp-json\/wp\/v2\/comments?post=172"}],"version-history":[{"count":7,"href":"https:\/\/ubikuity.net\/blog\/wp-json\/wp\/v2\/posts\/172\/revisions"}],"predecessor-version":[{"id":178,"href":"https:\/\/ubikuity.net\/blog\/wp-json\/wp\/v2\/posts\/172\/revisions\/178"}],"wp:attachment":[{"href":"https:\/\/ubikuity.net\/blog\/wp-json\/wp\/v2\/media?parent=172"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ubikuity.net\/blog\/wp-json\/wp\/v2\/categories?post=172"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ubikuity.net\/blog\/wp-json\/wp\/v2\/tags?post=172"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}