About Catel and the IEditableObject Interface

Jul 21, 2011 at 12:08 PM

I'd like to get a little deeper on this topic.

Do you have an specific example to share about the way it should be done using Catel?

Thanks in advance.

Coordinator
Jul 21, 2011 at 12:17 PM

The IEditableObject in Catel is supported in the ViewModelBase. A developer can choose whether the interface should be supported or not via the base class constructor.

The IEditableObject interface is only used when a viewmodel property is decorated with the Model attribute. Then the viewmodel calls BeginEdit() to let the object store it's state. Then it maps the ViewModelToModel decorated properties back and forth from the view model to the model and back (very useful to write validation in the model only once). Then, finally, when ViewModel.Save() is called, the viewmodel calls EndEdit() on all models. Otherwise, it will call CancelEdit() on them.

Is this enough information or do you want me to explain it more detailed?

Jul 22, 2011 at 1:35 PM

I will try writing a simple example about this to test this functionality.

Thank you so much...