Copied to clipboard

Flag this post as spam?

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


  • Madison James 31 posts 147 karma points
    Sep 20, 2018 @ 04:09
    Madison James
    0

    IgnorePropertyType umbracoNaviHide doesn't ignore

    [IgnorePropertyType("umbracoNaviHide")] doesn't ignore in 7.10.4 using ModelsBuilder API Model

    Tried in builder.cs and in separate class file.

    Anyone have any ideas

  • Dave Woestenborghs 3504 posts 12133 karma points MVP 8x admin c-trib
    Sep 20, 2018 @ 06:30
    Dave Woestenborghs
    1

    Hi James,

    This works fine for us.

    You need to create a seperate class with the same name as the one generated by modelsbuilder (in the same folder as the file you use to generate the models)

    Then you decorate that class with this attribute.

    Dave

  • Madison James 31 posts 147 karma points
    Sep 20, 2018 @ 07:05
    Madison James
    0

    As I indicated I tried both. I got this from 24 Days In when I moved to using the Models Builder API but just got around to testing extending the generated models. Everything else with the Models Builder API works perfectly.

        namespace ModelsBuilder.APIMode.Models
    {
        using Umbraco.ModelsBuilder;
    
        [IgnorePropertyType("umbracoNaviHide")]
        public partial class AboutUs
        { }
    }
    

    Run the builder and the property still exists in the generated model

  • Madison James 31 posts 147 karma points
    Sep 20, 2018 @ 07:15
    Madison James
    0

    Here is the complete statement when it runs if that is any clue

    UmbracoModelsBuilder: Starting v3.0.6.97 9/19/2018 10:55:29 PM. UmbracoModelsBuilder: Done.

    The builder will run just fine and makes any other model changes I make, whether I add the code to its own class or put it in the builder.cs file.

    It just doesn't ignore the property

  • Dave Woestenborghs 3504 posts 12133 karma points MVP 8x admin c-trib
    Sep 20, 2018 @ 07:45
    Dave Woestenborghs
    100

    Hi James,

    Is your property on the doctype class you decorated ? Or is it maybe on base doctype or a composition ?

    Then you need to attribute to that class.

    Dave

  • Madison James 31 posts 147 karma points
    Sep 20, 2018 @ 07:54
    Madison James
    0

    Thank you That worked. I hadn't dug deep enough, I was just following your article and didn't consider the compositions.

  • Dave Woestenborghs 3504 posts 12133 karma points MVP 8x admin c-trib
    Sep 20, 2018 @ 07:56
    Dave Woestenborghs
    0

    Ha,

    Good pointer. Should have mentioned that in my article.

    Glad you have it working now.

    Dave

Please Sign in or register to post replies

Write your reply to:

Draft