Extensibility Method Definitions

2 posts, 1 answers
  1. Dennis Gundersen
    Dennis Gundersen avatar
    23 posts
    Member since:
    Dec 2009

    Posted 15 Feb 2010 Link to this post

    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
  2. Answer
    Damyan Bogoev
    Admin
    Damyan Bogoev avatar
    581 posts

    Posted 18 Feb 2010 Link to this post

    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.
  3. DevCraft banner
Back to Top