none
Many-To-Many Self Referencing Property Not Showing Changes Saved To Database RRS feed

  • Question

  • I have an entity that contains a collection of the same entity.  I'm creating a many-to-many table for this collection to store and pull from within the OnModelCreating method.  So far I'm able to save changes to the database by accessing the collection but when I go to retrieve the changes by accessing the collection again it returns null.  I've made a post on stack overflow titled: Entity Framework - Lazy Loading Self Referencing Collections about this issue which contains code snippets

    Monday, November 25, 2013 12:19 AM

Answers

  • Hello,

    It is not self-referencing actually because we can see it will create two tables in database:

    I did not use the “include”, however it worked with your codes on the stackoverflow site.

    The result:

    I use VS2012, .NET 4.5, Entity Framework 5, WIN8(64bit)

    Regards.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Tuesday, November 26, 2013 1:11 AM
    Moderator