none
EF6 not saving changes RRS feed

  • Question

  • I'm struggling with a Entity Framework Problem. 

    After adding a new Entity to the DBSet that represents my Table and setting  the EntityState to Added, I checked "context.ChangeTracker.Entries"

    Here I can find my newly added entity. But after the call of SaveChangesAsync() the DB stays unchanged

    Any hints on how to further investigate this problem? THX!

    Working with EF6 against a local sql server DB

    Friday, January 9, 2015 12:57 PM

Answers

  • Hello Herr,

    >>Here I can find my newly added entity. But after the call of SaveChangesAsync() the DB stays unchanged

    Have you even checked the returned result of the SaveChangesAsync() to see if it saves changes successfully? If so, please make sure if you have a copied database, from my experience, usually, it would be in the bin folder, please check it.

    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.

    Monday, January 12, 2015 7:53 AM
    Moderator

All replies

  • You are most likely looking in the wrong place

    Please mark as answer, if this was it. Visit my SQL Server Compact blog http://erikej.blogspot.com

    Friday, January 9, 2015 1:22 PM
  • Try 

      ctx.SaveChanges();

    See it works.  And remove >> EntityState to Added, I checked "context.ChangeTracker.Entries"

    Friday, January 9, 2015 2:22 PM
  • Hello Herr,

    >>Here I can find my newly added entity. But after the call of SaveChangesAsync() the DB stays unchanged

    Have you even checked the returned result of the SaveChangesAsync() to see if it saves changes successfully? If so, please make sure if you have a copied database, from my experience, usually, it would be in the bin folder, please check it.

    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.

    Monday, January 12, 2015 7:53 AM
    Moderator