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)
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
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
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
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.
Run the builder and the property still exists in the generated model
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
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
Thank you That worked. I hadn't dug deep enough, I was just following your article and didn't consider the compositions.
Ha,
Good pointer. Should have mentioned that in my article.
Glad you have it working now.
Dave
is working on a reply...