Umbraco.Community.ModelsBuilder.PropertyOverride
                               
                            
                                15.0.2
                            
                        
                    dotnet add package Umbraco.Community.ModelsBuilder.PropertyOverride --version 15.0.2
NuGet\Install-Package Umbraco.Community.ModelsBuilder.PropertyOverride -Version 15.0.2
<PackageReference Include="Umbraco.Community.ModelsBuilder.PropertyOverride" Version="15.0.2" />
<PackageVersion Include="Umbraco.Community.ModelsBuilder.PropertyOverride" Version="15.0.2" />
<PackageReference Include="Umbraco.Community.ModelsBuilder.PropertyOverride" />
paket add Umbraco.Community.ModelsBuilder.PropertyOverride --version 15.0.2
#r "nuget: Umbraco.Community.ModelsBuilder.PropertyOverride, 15.0.2"
#:package Umbraco.Community.ModelsBuilder.PropertyOverride@15.0.2
#addin nuget:?package=Umbraco.Community.ModelsBuilder.PropertyOverride&version=15.0.2
#tool nuget:?package=Umbraco.Community.ModelsBuilder.PropertyOverride&version=15.0.2
Umbraco.Community.ModelsBuilder.PropertyOverride
This package re-introduces functionality for overriding ModelsBuilder property implementations that was lost in Umbraco 9+.
Umbraco versions 15.x are supported.
Properties can be marked up with a re-implemented [ImplementPropertyType("alias")] attribute, which causes them to be ignored when generating models through the default ModelsBuilder.
In addition, classes can be marked up with [ImplementAllPropertyTypes], which causes all properties on the class to be ignored, this is functionally equivalent to adding [ImplementPropertyType("alias")] to every property on the class.
Legacy (Umbraco 8.x) documentation for the [ImplementPropertyType("alias")] attribute can be found here.
Examples
[ImplementPropertyType("alias")] to ignore properties on an individual basis:
using Umbraco.Cms.Infrastructure.ModelsBuilder;
namespace ModelsBuilder.PropertyOverride.TestSite.Models
{
    public partial class Home
    {
        [ImplementPropertyType("content")]
        public global::Umbraco.Cms.Core.Models.Blocks.BlockListModel Content => this.Value<global::Umbraco.Cms.Core.Models.Blocks.BlockListModel>(_publishedValueFallback, "content");
        [ImplementPropertyType("title")]
        public virtual string Title => this.Value<string>(_publishedValueFallback, "title");
    }
}
[ImplementAllPropertyTypes] to ignore all properties:
using Umbraco.Cms.Infrastructure.ModelsBuilder;
namespace ModelsBuilder.PropertyOverride.TestSite.Models
{
    [ImplementAllPropertyTypes]
    public partial class HomePageBlock 
    {
        public virtual global::Umbraco.Cms.Core.Models.MediaWithCrops Image { get; set; }
        public virtual string SubTitle { get; set; }
        public virtual string Title { get; set; }
    }
}
Installation
Add the package to an existing Umbraco website (Umbraco 15.x) from nuget:
dotnet add package Umbraco.Community.ModelsBuilder.PropertyOverride
Contributing
Contributions to this package are most welcome!
Acknowledgments
| Product | Versions Compatible and additional computed target framework versions. | 
|---|---|
| .NET | net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. | 
- 
                                                    net9.0- Umbraco.Cms (>= 15.0.0 && < 16.0.0)
 
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.