Hello I have a UI like this
so What I want to do is: If I press the x button and close the form I want to undo all the changes on this record.
If you take a closer to the UI you can see that there is a another form for the browsing purpose. Both forms use the same context.
so what happens is this. when I close and reopen the same record I get the above UI
below Is how I fill the BindingSource dynamically.
Base4Data = ((dynamic)(IQueryable)Context.GetPropValue(TableName)).Find(MyPkValue);
things I tried on FormClosing event:
1- Setting the current context to a new dbcontext instance on formclose
2- Create new transaction in form handlecreate and rollback transaction on formclose
3- ((IObjectContextAdapter)Context).ObjectContext.Refresh(RefreshMode.StoreWins, Base4Data);
4- Context.Entry(Base4Data).Reload();
non of the above work, so any suggestions are very appreciated