Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Should IDataErrorInfo.Error check every property?

Should IDataErrorInfo.Error check every property? Or can I trust any clients to call IDataErrorInfo.Item on every property?

like image 828
Jonathan Allen Avatar asked Jun 05 '10 04:06

Jonathan Allen


1 Answers

IDataErrorInfo.Error is used to report the validation state for the whole object.

For example if your object have properties StartTime and EndTime you will probably want StartTime to be less than the EndTime and if this validation rule is broken it wont be appropriate to display a message neither for one nor the other property.

Error property is also appropriate to summarize the overall validation state of your object. So the answer is no - you shouldn't check every property. The error messages related to particular property are exposed by

string this[string columnName]

indexer.

EDIT: here a link that explains how the interface is supposed to be used.

like image 61
Koynov Avatar answered Oct 14 '22 10:10

Koynov