Error when save modifed record using LightSwich on Azure RRS feed

  • Question

  • I am using Light switch on Azure.

    After I modified a column in a record when I click the Save button I got

    "Store update, insert, or delete statement affected an unexpected number of rows(0). Entties may have been modified or deleted since entities were loaded, Refresh ObjectStateManager entries.

    I use VS 2012 on my dev machine debug this light switch app. it works fine and no errors when I modify the save column on same records then save it.

    Is anybody in this forum has idea what could cause this? and how should I work around it?

    I suspect the azure machine don't have the same version of EF with my dev machine. but in the Light switch project both client and server reference I could not find the EF is referenced there. So I don't know how I can bring the EF dll on my machine up to Azure machine.

    When it working on dev machine it is pointed to the production database. In other words on Azure and on my dev machine the LightSwitch app is pointing to the same database. And it works on my dev machine but get error on Azure.

    And I am pretty sure in the production environment (Azure) there is only one user (myself) using it when the error occurs and no other user changed anything on the record neither through the lightswitch UI or by other means. so there is no concurrent usage of the database during that time frame.

    Anybody could give me some suggestion on this?

    Friday, February 15, 2013 10:32 PM

All replies

  • I just tried to add a record for that table in production. and it get the same error message. I also tried it on my dev box to add a record to that table and it is successes. after I added the record through my dev box I tried to delete it from production site and it also got that same error. but I deleted it successes from my dev machine. and it is deployed as cloud service.
    Saturday, February 16, 2013 8:40 PM
  • And I also tried to create new record and update in another table it works fine in production the difference between the 2 tables are the table get error has one insert trigger and one update trigger. and it works fine on dev box point to production db which is on SQL Azure
    Saturday, February 16, 2013 8:54 PM
  • The version of Entity Framework should be the same on the Azure Cloud Service machine.  What are the database triggers set up to do?

    David Kidder | Senior SDET | Microsoft | LightSwitch

    Monday, February 18, 2013 1:35 AM
  • The insert trigger is after insert trigger the update trigger is instead of update triger

    the trigger calculate some columns value based on the other columns  and decide if the record need to be put in a tmp table for further process or not.

    Monday, February 18, 2013 6:06 PM
  • Sorry, I missed that you had responded to this.  I have asked the rest of the team for input, we'll get back to you soon.

    David Kidder | Senior SDET | Microsoft | LightSwitch

    Thursday, February 21, 2013 10:29 PM
  • Can you post the trigger definitions?  If you don't want to post them could you email them to me?  david (dot) kidder (at) microsoft (dot) com

    David Kidder | Senior SDET | Microsoft | LightSwitch

    Friday, February 22, 2013 3:42 AM
  • It is pretty complex trigger I will send them to you through email. because it is hard to format it in there to make them readable.

    Friday, February 22, 2013 8:05 PM