Umbraco.Community.ModelsBuilder.PropertyOverride
1.0.1
See the version list below for details.
dotnet add package Umbraco.Community.ModelsBuilder.PropertyOverride --version 1.0.1
NuGet\Install-Package Umbraco.Community.ModelsBuilder.PropertyOverride -Version 1.0.1
<PackageReference Include="Umbraco.Community.ModelsBuilder.PropertyOverride" Version="1.0.1" />
<PackageVersion Include="Umbraco.Community.ModelsBuilder.PropertyOverride" Version="1.0.1" />
<PackageReference Include="Umbraco.Community.ModelsBuilder.PropertyOverride" />
paket add Umbraco.Community.ModelsBuilder.PropertyOverride --version 1.0.1
#r "nuget: Umbraco.Community.ModelsBuilder.PropertyOverride, 1.0.1"
#addin nuget:?package=Umbraco.Community.ModelsBuilder.PropertyOverride&version=1.0.1
#tool nuget:?package=Umbraco.Community.ModelsBuilder.PropertyOverride&version=1.0.1
Models Builder .Property Override
This package provides functionality for overriding Models Builder property implementations.
Umbraco versions 13.x - 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 Models Builder.
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 (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 (v13+) 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 | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. 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. |
-
net8.0
- Umbraco.Cms.Web.BackOffice (>= 13.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.