Updates to Core.Configuration Models to use DefaultValue attribute to allow auto generated JSONSchema to give a default value in schema

This commit is contained in:
Warren Buckley
2021-07-05 14:27:49 +01:00
parent cd36d050c5
commit 6b73ea767f
28 changed files with 372 additions and 106 deletions

View File

@@ -1,6 +1,8 @@
// Copyright (c) Umbraco.
// See LICENSE for more details.
using System.ComponentModel;
namespace Umbraco.Cms.Core.Configuration.Models
{
/// <summary>
@@ -9,6 +11,9 @@ namespace Umbraco.Cms.Core.Configuration.Models
[UmbracoOptions(Constants.Configuration.ConfigNuCache)]
public class NuCacheSettings
{
internal const string StaticNuCacheSerializerType = "MessagePack";
internal const int StaticSqlPageSize = 1000;
/// <summary>
/// Gets or sets a value defining the BTree block size.
/// </summary>
@@ -17,11 +22,13 @@ namespace Umbraco.Cms.Core.Configuration.Models
/// <summary>
/// The serializer type that nucache uses to persist documents in the database.
/// </summary>
public NuCacheSerializerType NuCacheSerializerType { get; set; } = NuCacheSerializerType.MessagePack;
[DefaultValue(StaticNuCacheSerializerType)]
public NuCacheSerializerType NuCacheSerializerType { get; set; } = Enum<NuCacheSerializerType>.Parse(StaticNuCacheSerializerType);
/// <summary>
/// The paging size to use for nucache SQL queries.
/// </summary>
public int SqlPageSize { get; set; } = 1000;
[DefaultValue(StaticSqlPageSize)]
public int SqlPageSize { get; set; } = StaticSqlPageSize;
}
}