Fix errors

This commit is contained in:
Nikolaj Geisle
2022-02-21 12:49:17 +01:00
parent cb44dc70f3
commit 57f32100cb
8 changed files with 24 additions and 10 deletions

View File

@@ -9,7 +9,7 @@ namespace Umbraco.Cms.Core.Models.ContentEditing
public class PropertyTypeValidation
{
[DataMember(Name = "mandatory")]
public bool? Mandatory { get; set; }
public bool Mandatory { get; set; }
[DataMember(Name = "mandatoryMessage")]
public string? MandatoryMessage { get; set; }

View File

@@ -46,7 +46,7 @@ namespace Umbraco.Cms.Core.Models
/// <summary>
/// Gets of sets a value indicating whether a value for this property type is required.
/// </summary>
bool? Mandatory { get; set; }
bool Mandatory { get; set; }
/// <summary>
/// Gets or sets a value indicating whether the label of this property type should be displayed on top.

View File

@@ -48,7 +48,7 @@ namespace Umbraco.Cms.Core.Models.Mapping
dest.LabelOnTop = originalProp.PropertyType?.LabelOnTop;
//add the validation information
dest.Validation.Mandatory = originalProp.PropertyType?.Mandatory;
dest.Validation.Mandatory = originalProp.PropertyType?.Mandatory ?? false;
dest.Validation.MandatoryMessage = originalProp.PropertyType?.MandatoryMessage;
dest.Validation.Pattern = originalProp.PropertyType?.ValidationRegExp;
dest.Validation.PatternMessage = originalProp.PropertyType?.ValidationRegExpMessage;

View File

@@ -317,7 +317,7 @@ namespace Umbraco.Cms.Core.Models.Mapping
target.Name = source.Label;
target.DataTypeId = source.DataTypeId;
target.DataTypeKey = source.DataTypeKey;
target.Mandatory = source.Validation?.Mandatory;
target.Mandatory = source.Validation?.Mandatory ?? false;
target.MandatoryMessage = source.Validation?.MandatoryMessage;
target.ValidationRegExp = source.Validation?.Pattern;
target.ValidationRegExpMessage = source.Validation?.PatternMessage;

View File

@@ -25,7 +25,7 @@ namespace Umbraco.Cms.Core.Models
private Lazy<int>? _propertyGroupId;
private string _propertyEditorAlias;
private ValueStorageType _valueStorageType;
private bool? _mandatory;
private bool _mandatory;
private string? _mandatoryMessage;
private int _sortOrder;
private string? _validationRegExp;
@@ -178,7 +178,7 @@ namespace Umbraco.Cms.Core.Models
/// <inheritdoc />
[DataMember]
public bool? Mandatory
public bool Mandatory
{
get => _mandatory;
set => SetPropertyValueAndDetectChanges(value, ref _mandatory, nameof(Mandatory));