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

Extensibility Method Definitions

1 Answer 54 Views
Getting Started
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Dennis Gundersen
Top achievements
Rank 1
Dennis Gundersen asked on 15 Feb 2010, 04:41 PM
Hi

I'm trying to learn OO programming and start using LINQ and OA. When reading about LINQ I noticed the auto-generated partial methods under "Extensibility Method Definitions". They look to me like event handling primers, or whatever it's called, firing off automatically when something happens to a class. I assume it's where I'm supposed to add validation code etc. Neat!

How does this work in OA? I don't see any such methods when mapping my classes using OA, and I'd really like to remove all validation methods from the GUI of my apps. (I've got some check that this date comes after another date type logic that I currently impement on several forms).

In particular, I'd like to be able to set default values on object creation, check values on updating (the property, not the database as I do now), and in general give immidiate feedback without having to incur a save method.

I did find two interfaces called INotifyPropertyChanging and INotifyPropertyChanged mentioned on a help page. Are those two interfaces enough to do all the stuff that Extensibility Method Definitions offers?

I'm a newbie programmer so I can't see what I will eventually need down the line, which makes it difficult to decide if OA is the way to go in order to both learn OO programming, and improving my currently rather unstable and unflexible solution.

Re
Dennis

1 Answer, 1 is accepted

Sort by
0
Accepted
Damyan Bogoev
Telerik team
answered on 18 Feb 2010, 05:12 PM
Hi Dennis Gundersen,

There are at least two possible ways of implementing data validation.
The first approach is to implement the INotifyPropertyChanging and INotifyPropertyChanged interfaces and validate the values before the property is set.

Another approach is to provide custom validation logic inside the event handlers of the ITracking.Adding and ITracking.Changing events provided by OpenAccess:
- ITracking.Adding occurs before a persistent object is added to the object scope;
- ITracking.Changing occurs before a field of a persistent object is changed;
You can have a look at the following article for details.
I hope the provided information will be helpful to you. If any other questions arise please contact us again.

Regards,
Damyan Bogoev
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
Getting Started
Asked by
Dennis Gundersen
Top achievements
Rank 1
Answers by
Damyan Bogoev
Telerik team
Share this question
or