Missing DataErrorInfoAdapter in latest MvvmValidation package

138 Views Asked by At

After updating the MvvmValidation NuGet package from version 2.0.2 to 3.1.0, I get the error:

The type or namespace name 'DataErrorInfoAdapter' could not be found (are you missing a using directive or an assembly reference?)

My ValidatableViewModelBase.cs looks like this:

public abstract class ValidatableViewModelBase : ViewModelBase, IDataErrorInfo
{
    public ValidationHelper Validator { get; } = new ValidationHelper();
    public DataErrorInfoAdapter DataErrorInfoAdapter { get; set; } // this type does not exist
    [...]

    protected ValidatableViewModelBase()
    {
        this.DataErrorInfoAdapter = new NotifyDataErrorInfoAdapter(this.Validator);
        [...]
    }

    #region IDataErrorInfo

    [Ignore]
    public string Error => this.DataErrorInfoAdapter.Error;

    [Ignore]
    public string this[string columnName] => this.DataErrorInfoAdapter[columnName];

    #endregion IDataErrorInfo
}

I was not able to find any migration guidelines on how to replace the deprecated DataErrorInfoAdapter. All I could find was some information about the NotifyDataErrorInfoAdapter, but I am not quite sure if I need to change my ValidatableViewModelBase to implement INotifyDataErrorInfo interface.

Do you have any advice or reference documentation for me? Can someone explain to me, why they dropped DataErrorInfoAdapter but not IDataErrorInfo?

1

There are 1 best solutions below

0
mm8 On BEST ANSWER

They actually seem to have dropped the support for the IDataErrorInfo interface.

The new NotifyDataErrorInfoAdapter implements the INotifyDataErrorInfo that has been around since .NET Framework 4.5 was released. Here is an example and more information about how to implement it.

If you want to stick to IDataErrorInfo for some reason, it makes no sense to upgrade MvvmValidation to the latest version.