I'm developing a WPF application (MVVM). I have a class from a separate assembly (Odata V4 Generated Proxy Class).
public partial class Book : BaseEntityType, INotifyPropertyChanged
{
public string Title{get;set;}
...
}
Now I need to decorate the properties of that class with data annotations, in order to validate the properties using either IDataErrorInfo
or INotifyDataErrorInfo
interface.
Ex:
[Required]
public string Title{get;set;}
Problem:
As this class is in separate assembly, I cannot create a partial class. Properties of this class are bounded to UI elements of application. Now I need to validate the properties, when user input's data.
I'm struggling to design the solution. Could any one help me to acheive this?
A wrapper might look like this:
This way you don't mess with your data object(Book) and you dont litter it with unnecessary interfaces.