Copied to clipboard

Flag this post as spam?

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


  • Tate 4 posts 74 karma points
    Sep 08, 2023 @ 12:17
    Tate
    0

    How to Add Generation Rules for Model Builder in Umbraco 12 Application?

    I need to ignore some fields while generating the models, in my Umbraco 8 application I am using IgnorePropertyType attribute from Umbraco.ModelsBuilder.

    For example:

    [IgnorePropertyType("allowedGroups")]
    public partial class WebComponent 
    {
    }
    

    I need the same to implement in my Umbraco 12 application.

  • Marc Goodson 2149 posts 14354 karma points MVP 9x c-trib
    Sep 08, 2023 @ 13:06
    Marc Goodson
    0

    Hi Tate

    'I think' IgnorePropertyType was part of the Original Modelsbuilder project and wasn't imported into the core version when it was made part of the project?

    (I could be wrong)

    The only project I've seen for Umbraco .NET Core versions that appears to extend Modelsbuilder is Limbo Models Builder:

    https://github.com/limbo-works/Limbo.Umbraco.ModelsBuilder/tree/v1/main

    This would I think give you more control over how the models are generated.

    regards

    Marc

  • Tate 4 posts 74 karma points
    Sep 18, 2023 @ 14:38
    Tate
    0

    Hi Marc,

    thanks for your response.

    I tried to use the Limbo.Umbraco.ModelsBuilder I created a separate class with the same name as the one generated and added IgnorePropertyType attribute with the field names which ones should be ignored but it doesn't work.

    I also added in the models application csproj file.

    Could you please explain me how should I config that?

    Best regards, Tate

Please Sign in or register to post replies

Write your reply to:

Draft