Quantcast
Channel: Developer to developer
Viewing all articles
Browse latest Browse all 9076

Pages and interface inheritance

$
0
0

I have pages that implements interfaces with inheritance. When I pass a page to a view that expects the interface, the inherited properties are missing.

public class StandardPage : PageData, IMainBody
{
        [CultureSpecific]
        [Display(Name = "Main intro")]
        public virtual XhtmlString MainIntro { get; set; }
        [CultureSpecific]
        [Display(Name = "Main body")]
        public virtual XhtmlString MainBody { get; set; }
}
public interface IMainBody : IBody
{
}
public interface IBody
{
        XhtmlString MainBody { get; set; }
}

I can add the property to both interfaces and then it works fine.

public class StandardPage : PageData, IMainBody
{
        [CultureSpecific]
        [Display(Name = "Main intro")]
        public virtual XhtmlString MainIntro { get; set; }
        [CultureSpecific]
        [Display(Name = "Main body")]
        public virtual XhtmlString MainBody { get; set; }
}
public interface IMainBody : IBody
{
        XhtmlString MainBody { get; set; }
}
public interface IBody
{
        XhtmlString MainBody { get; set; }
}

Am I misunderstanding how this should work, and this is expected?


Viewing all articles
Browse latest Browse all 9076

Trending Articles