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

Bug when using inheritance and INotifyPropertyChanged(ing)

1 Answer 63 Views
Design Time (Visual Designer & Tools)
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Norbert
Top achievements
Rank 2
Norbert asked on 28 Feb 2012, 04:23 PM
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

1 Answer, 1 is accepted

Sort by
0
Zoran
Telerik team
answered on 02 Mar 2012, 01:53 PM
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 >>
Tags
Design Time (Visual Designer & Tools)
Asked by
Norbert
Top achievements
Rank 2
Answers by
Zoran
Telerik team
Share this question
or