modelsbuilder / ModelsBuilder.Original

The Community Models Builder for Umbraco
MIT License
114 stars 49 forks source link

Generated Models missing PublishedElementModel on generated model. #251

Open martinmcd1 opened 3 years ago

martinmcd1 commented 3 years ago

I am currently using umbraco v 8.9.0 modelsbuilder 8.1.6 modelsbuilder.api 8.1.6

When I run "Build Models" using the .mb file some of my generated models are missing base classes. So for example i get the following which is missing the PublishedElementModel class.

//------------------------------------------------------------------------------ // // This code was generated by a tool. // // Umbraco.ModelsBuilder v8.1.6 // // Changes to this file will be lost if the code is regenerated. // //------------------------------------------------------------------------------

using System; using System.Collections.Generic; using System.Linq.Expressions; using System.Web; using Umbraco.Core.Models; using Umbraco.Core.Models.PublishedContent; using Umbraco.Web; using Umbraco.ModelsBuilder; using Umbraco.ModelsBuilder.Umbraco;

namespace Umbraco.Web.PublishedModels { ///

Accordion [PublishedModel("accordion")] public partial class Accordion { // helpers

pragma warning disable 0109 // new is redundant

    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Umbraco.ModelsBuilder", "8.1.6")]
    public new const string ModelTypeAlias = "accordion";
    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Umbraco.ModelsBuilder", "8.1.6")]
    public new const PublishedItemType ModelItemType = PublishedItemType.Content;
    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Umbraco.ModelsBuilder", "8.1.6")]
    public new static IPublishedContentType GetModelContentType()
        => PublishedModelUtility.GetModelContentType(ModelItemType, ModelTypeAlias);
    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Umbraco.ModelsBuilder", "8.1.6")]
    public static IPublishedPropertyType GetModelPropertyType<TValue>(Expression<Func<Accordion, TValue>> selector)
        => PublishedModelUtility.GetModelPropertyType(GetModelContentType(), selector);

pragma warning restore 0109

    // ctor
    public Accordion(IPublishedElement content)
        : base(content)
    { }

    // properties

    ///<summary>
    /// Anchor name
    ///</summary>
    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Umbraco.ModelsBuilder", "8.1.6")]
    [ImplementPropertyType("anchorName")]
    public string AnchorName => this.Value<string>("anchorName");

    ///<summary>
    /// Background colour
    ///</summary>
    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Umbraco.ModelsBuilder", "8.1.6")]
    [ImplementPropertyType("backgroundColour")]
    public Umbraco.Core.PropertyEditors.ValueConverters.ColorPickerValueConverter.PickedColor BackgroundColour => this.Value<Umbraco.Core.PropertyEditors.ValueConverters.ColorPickerValueConverter.PickedColor>("backgroundColour");

    ///<summary>
    /// Disable block
    ///</summary>
    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Umbraco.ModelsBuilder", "8.1.6")]
    [ImplementPropertyType("disableBlock")]
    public bool DisableBlock => this.Value<bool>("disableBlock");

    ///<summary>
    /// Text
    ///</summary>
    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Umbraco.ModelsBuilder", "8.1.6")]
    [ImplementPropertyType("text")]
    public string Text => this.Value<string>("text");

    ///<summary>
    /// Title
    ///</summary>
    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Umbraco.ModelsBuilder", "8.1.6")]
    [ImplementPropertyType("title")]
    public string Title => this.Value<string>("title");
}

}

I tried changing the modelsbuilder mode to Dlls and it successfully generates the class inheriting the PublishedElementModel.

Any ideas? Thanks, Martin