At first sight the code looks fine and it should work correctly. Unfortunately looking into this code fragment we couldn't see the surrounded code and the problems which could derived from that.
Could you make some verification and provide the result to us:
- Could you check what is the current value of the restaurantToUpdate.website property and the value of the website.Text property? Is it possible that the value of the website.Text property is not what you are seeing in the website?
- Could you check what is in the collection of the changed items in the context after you change the property value? You could access the collection through the GetChanges()
method in the OpenAccessContext class - dbContext.GetChanges(). Could you find your entity in this collection?
- Could you check the state of the restaurantToUpdate object after you changed the property value? You could take the state with the GetState() method in the OpenAccessContext class - dbContext.GetState(restaurantToUpdate). If the property is changed correctly, the state of the object should be Dirty. More information about object states you could find here
Answering these questions and any other information which you could provide for you scenario, will help us to understand the issue.
I am looking forward to hearing from you.
OpenAccess ORM is now Telerik Data Access
. For more information on the new names, please, check out the Telerik Product Map