This is a migrated thread and some comments may be shown as answers.

IDataErrorInfo

1 Answer 25 Views
Development (API, general questions)
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Klaas
Top achievements
Rank 1
Klaas asked on 28 Nov 2013, 04:55 PM

Hi,


I was wondering why properties are tested when you "get" them instead of setting them when using the IDataErrorInfo interface ?

Data from the database should always be correct so i think when you set a property to save it to the db it must then be tested and the otherway around ?



Any info on this ?



Best regards,



Klaas

1 Answer, 1 is accepted

Sort by
0
Dimitar Tachev
Telerik team
answered on 03 Dec 2013, 12:20 PM
Hi Klaas,

The IDataErrorInfo interface contains an Error property providing the current error message for the object and an indexer for validating a property by name most often used for a validation by the UI controls supporting this interface:
public interface IDataErrorInfo
{
    string Error { get; }
 
    string this[string columnName] { get; }
}


Regarding the issue that you have described - the code generated by Telerik OpenAccess ORM is validating the entities in the indexer and you should not have any validations in the getters of your properties.

You could find more information about our IDataErrorInfo support in this blog post and the documentation article describing its recommended implementation. I also suggest you take a look at this blog post demonstrating how to use the interface in WPF applications.

Could you please confirm that without applying any changes on our code generation templates you are getting the ValidatePropertyInternal method calls in the getters of your properties instead of in the indexer?

I am looking forward to your feedback.


Regards,
Dimitar Tachev
Telerik
OpenAccess ORM Q3 2013 simplifies your model operations even further providing you with greater flexibility. Check out the list of new features shipped with our latest release!
Tags
Development (API, general questions)
Asked by
Klaas
Top achievements
Rank 1
Answers by
Dimitar Tachev
Telerik team
Share this question
or