locked
Refresh after saving grid on attached table RRS feed

  • Question

  • To duplicate my problem:

    Create new lightswitch desktop application (Silverlight) attach to one sql table with 2 fields, Id int (identity, primary key), and Desc string.

    Generate editable grid using the table. Enter one row and save it. Delete the row and the save will produce a entity conflict error.

    Generally the problem is that with attached tables, the save repopulates the grid but freshly added records cannot  be deleted because the entity conflict routine incorrectly finds a conflict on the index value. After the save one must refresh the screen to prevent the incorrect entity conflict on saving a delete.

    My current workaround is to get the maximum index on the screen's initial load, then use this maximum to reload new rows after a save:      

      partial void MainAccounts_Saving(ref bool handled)
            {
                this.DataWorkspace.TejanaData.SaveChanges();
                foreach (MainAccount m in MainAccounts1.Where(t => t.Id > maxId )))
                {
                        var v = DataWorkspace.TejanaData.MainAccounts_SingleOrDefault(m.Id);
                 }   
                handled = true;
            }

    Is this reproducible incorrect error a bug that will be fixed or is there a better work around? Any suggestions would be greatly appreciated.

    Thanks,

    Mike


    • Edited by dynds1 Monday, April 3, 2017 4:57 AM
    Monday, April 3, 2017 4:43 AM