Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generated Models missing PublishedElementModel on generated model. #251

Open
martinmcd1 opened this issue Dec 8, 2020 · 0 comments
Open

Comments

@martinmcd1
Copy link

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(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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant