Bug when using inheritance and INotifyPropertyChanged(ing)

Thread is closed for posting
2 posts, 0 answers
  1. Norbert
    Norbert avatar
    35 posts
    Member since:
    Dec 2009

    Posted 28 Feb 2012 Link to this post


    I think there is a little problem when I want to model inheritance in the designer. I've changed the code generation template the way that it implements INotifyPropertyChanged... and when I want to model the inheritance following happens...
    namespace ES.Abs.Core  
        public abstract partial class DomainClass1 : Interface2 : INotifyPropertyChanged, INotifyPropertyChanging
            private int _id;
            public virtual int Id
                    return this._id;
                    if( Id == value )

    Everytime I save the diagram the designer changes it again...so I can't use inheritance :-(((

    Thank you very much,
  2. Zoran
    Zoran avatar
    534 posts

    Posted 02 Mar 2012 Link to this post

    Hello Norbert,

     It is true that when there is an interface implementation, OpenAccess always generates ":NameOfInreface" and when you change the template to implement INotifyPropertyChanged, you end up with uncompilable code. What you should do, is to add an additional check in the template code where you decide if the first symbol before "INotifyPropertyChanged" should be ',' or ':'. Here is the check you should add:

    string firstCharacter = ":";
    if (codeClass.Implements.Count() > 0)
        firstCharacter = ",";

    That way you will be able to place ',' after the implemented interface name and have compilable code even in the situations where there is an additional interface implemented in the designer.Greetings,
    the Telerik team
    Telerik OpenAccess ORM Q1 2012 release is here! Check out what's new or download a free trial >>
Back to Top