Bug when using inheritance and INotifyPropertyChanged(ing)

2 posts, 0 answers
  1. Norbert
    Norbert avatar
    35 posts
    Member since:
    Dec 2009

    Posted 28 Feb 2012 Link to this post

    Hello,

    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
            {
                get
                {
                    return this._id;
                }
                set
                {
                    if( Id == value )
                       return;
    ....

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

    Thank you very much,
    Norbert
  2. Zoran
    Admin
    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,
    Zoran
    the Telerik team
    Telerik OpenAccess ORM Q1 2012 release is here! Check out what's new or download a free trial >>
  3. DevCraft banner
Back to Top