ModelBase used in abstract class not reconized in derived class

Topics: Feature requests
Aug 20, 2014 at 1:34 PM
Edited Aug 20, 2014 at 2:55 PM
Geert,
I have an abstract class PropertyBase that uses the ModelBase as its base class. This abstract class is then used as the base class for another abstract class DomainDependentBase. Finally when I create a class using the abstract DomainDependentBase as the base, when the derived class is used as a model in a view, I get an error saying that the derived class is not a Catel Model. Is it because I am using 2 abstract classes with the model base used in the lowest level base class or is it something else.
Thanks
Bob

Example:
DisplayProperties -> PropertyBase -> ModelBase
Cursor -> DomainDependentBase -> PropertyBase -> ModelBase

then
Cursor is a property of DisplayProperties

when
DisplayProperties is injected into a viewmodel with DisplayProperties.Cursor assigned to a [Model] property of the viewmodel I get the following error

There is no model 'Cursor' registered with the model attribute, so the ViewModelToModel attribute on property 'XFormatIndex' is invalid. Make sure that the property is a Catel property, not a regular property. If you are sure that you have a model with this name, make sure it's public instead of private or protected for Silverlight and WP7 because non-public reflection is not allowed in Silverlight.

Code
    public abstract class PropertyBase : ModelBase
    {
        protected PropertyBase()
        {
           .....Do stuff ...
        }
    }

    public abstract class DomainDependentBase : PropertyBase
    {
        protected DomainDependentBase(IProcessingDomain properties)
        {
           .....Do stuff ...
        }
    }

    public class Cursor : DomainDependentBase, ICursor
    {
        public Cursor(
            IDatabaseService databaseService,
            IProcessingDomain domainProperties,
            bool dropFirst = false)
            : base(domainProperties)
        {
           .....Do stuff ...
        }

        public int XFormatIndex { get; set; }

    }

    public class DisplayProperties : ModelBase, IDisplayProperties
    {
        public DisplayProperties(
            IDatabaseService databaseService,
            IProcessingDomain domainProperties,
            IDataBufferPool dataBufferPool)
        {
            this.Cursor = new Cursor(databaseService, domainProperties);
        }

        public ICursor Cursor { get; set; }

    }

    public class CursorFormatViewModel : ViewModelBase
    {
        public CursorFormatViewModel(IDisplayProperties displayProperties)
        {
            this.Cursor = displayProperties.Cursor;
        }

        [Model]
        public ICursor Cursor { get; set; }

        [ViewModelToModel("Cursor")]
        public string XFormatIndex { get; set; }
    }
Coordinator
Aug 20, 2014 at 7:52 PM
1) Please create repro
2) Please create issue on official issue tracker
3) Specify which version you are using

Then we might be able to help.