INotifyDataErrorInfo.GetErrors issue

INotifyDataErrorInfo.GetErrors issue

Old forum URL: forums.lhotka.net/forums/t/9975.aspx


Peran posted on Monday, January 24, 2011

Hi Rocky,

The msdn documentation gives this description for INotifyDataErrorInfo.GetErrors(string propertyName)

 

Gets the validation errors for a specified property *or for the entire entity*.

 

The current implementation in Csla.Core.BusinessBase will not return errors for the entire entity if propertyName = string.Empty

 

    System.Collections.IEnumerable INotifyDataErrorInfo.GetErrors(string propertyName)

    {

      return BusinessRules.GetBrokenRules()

        .Where(c => c.Property == propertyName && c.Severity == RuleSeverity.Error)

        .ToList();

    }

The following modification would:

 

    System.Collections.IEnumerable INotifyDataErrorInfo.GetErrors(string propertyName)

    {

      return BusinessRules.GetBrokenRules()

        .Where(c => (string.IsNullOrEmpty(propertyName) || c.Property == propertyName) && c.Severity == RuleSeverity.Error)

        .ToList();

    }

 

Shall I raise an issue on bugtracker?

Regards

 

Peran

RockfordLhotka replied on Monday, January 24, 2011

Yes, please add this as a bug, thanks

Copyright (c) Marimer LLC