Our.Umbraco.Emptiness 2.0.3

dotnet add package Our.Umbraco.Emptiness --version 2.0.3
NuGet\Install-Package Our.Umbraco.Emptiness -Version 2.0.3
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Our.Umbraco.Emptiness" Version="2.0.3" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Our.Umbraco.Emptiness --version 2.0.3
#r "nuget: Our.Umbraco.Emptiness, 2.0.3"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Our.Umbraco.Emptiness as a Cake Addin
#addin nuget:?package=Our.Umbraco.Emptiness&version=2.0.3

// Install Our.Umbraco.Emptiness as a Cake Tool
#tool nuget:?package=Our.Umbraco.Emptiness&version=2.0.3

Emptiness

.NET Nuget

Nullable Property Value Converters for value types in Umbraco.

Install it:

dotnet add package Our.Umbraco.Emptiness

Why would I want that?

If an editor hasn't set a value for a "value type" property, then these converters will return null instead of a default value. This makes editor intent clearer - you can tell the difference between an integer that an edtor intentionally chose to be "0" as opposed to an integer property that's been left empty.

The Converters

Nullable Property Value Converters

Return null if an editor has not entered a value.

Enabled by default:
  • NullableDatePickerConverter
  • NullableDecimalConverter
  • NullableIntegerConverter
Disabled by default:
  • NullableLabelConverter

Property Value Converters for Toggles (True/False)

Though they don't have a null state in the UI, they can be empty if:

  1. A property has been added to a content type, but some content of that type has not been (re)published since.
  2. Content has been created via the API, without the property value having been set.

In these cases the following converters might be helpful...

YesNoDefaultConverter

Enabled by default. This converter returns the "Initial State" (default) value that has been configured in the property editor's settings.

NullableYesNoConverter

Disabled by default.

Configuration

You can configure Emptiness with appsettings.json like this:

  "Emptiness": {
    "EnabledConverters": [
      "NullableDatePickerConverter",
      "NullableDecimalConverter",
      "NullableIntegerConverter"
    ],
    "TrueFalseConverter": "DefaultValue"
  }

This is the default configuration.

EnabledConverters

If provided, enables only the PVCs listed.

Property Value Converter names:

  • NullableDatePickerConverter
  • NullableDecimalConverter
  • NullableIntegerConverter
  • NullableLabelConverter

TrueFalseConverter

Determines the True/False (Yes/No) conveter to use for booleans.

Options:

  • Core - use Umbraco's built in converter.
  • DefaultValue - use the YesNoDefaultConverter
  • Nullable - use the NullableYesNoConverter

Copyright © 2022 Jason Elkin

Licensed under the MIT License.

Crate image created by vectorpocket - www.freepik.com

Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
2.0.3 464 1/20/2023
2.0.2 316 11/3/2022
2.0.1 332 11/3/2022
2.0.0 422 6/27/2022
1.1.0 423 4/13/2022
1.0.0 375 4/1/2022
1.0.0-beta 153 4/1/2022