Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Sean Håkansson 66 posts 192 karma points
    Jun 26, 2019 @ 11:34
    Sean HÃ¥kansson
    0

    Model.Value on interface model generates error "Property is not marked with ImplementPropertyType attribute"

    Ok so I have a Composition Header that is used accross my website. In my master view template I have a partial called Header.

            @inherits Umbraco.Web.Mvc.UmbracoViewPage<IHeader>
    
            var headerPicker = Model.Value(x => x.HeaderPicker, fallback: Fallback.ToAncestors);
    

    This generates following error

    Property is not marked with ImplementPropertyType attribute.
    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 
    Exception Details: System.InvalidOperationException: Property is not marked with ImplementPropertyType attribute.
    

    The generated Headers model has this tag:

    [ImplementPropertyType("headerPicker")]
    

    However the Interface (IHeader) obviously do not, and I'm suspecting this whats causing my issue.

    This seems to work fine though:

    var headerPicker = Model.Value<IEnumerable<IPublishedContent>>("HeaderPicker", fallback: Fallback.ToAncestors);
    

    Is this a bug in Umbraco, or .net? How do other Umbracians use this? Reason why I want to use Model.Value is because I want to start using Language fallbacks, is there some other way to use Language Fallbacks with models builder outside of Model.Value?

    Thank you for any help and pointers!

Please Sign in or register to post replies

Write your reply to:

Draft