Entity is currently read-only
- by George Evjen
Quick post on an issue that we were having today. This fix may just be a band-aid for another issue but this fix at least got us moving again today. Since I didn’t see anything concrete online for a solution I figured I would post this as a part one fix and then post a more detailed fix later. We were getting this error earlier today in one of our projects that uses EF and WCF Ria Services. This entity is currently read-only. One of the following conditions exist: a custom method has been invoked, a submit operation is in progress, or edit operations are not supported for the entity type. The work around that we used for this is to simply do a check to see if the property is read only. Each entity has that property on it. private void SelectedInstitution_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) { if (!_personDetailContext.CurrentPerson.IsReadOnly) { _personDetailContext.CurrentPerson.LastUpdatedDate = DateTime.Now; } }
We check to see if the CurrentPerson in this situation is readonly. If its not read only we go ahead and execute some other code.
Again, this got us moving today, I am sure this is just step one in resolving this issue.