diff --git a/src/Umbraco.Core/Models/RelationItem.cs b/src/Umbraco.Core/Models/RelationItem.cs
index cebbc20951..f4e7e30aaf 100644
--- a/src/Umbraco.Core/Models/RelationItem.cs
+++ b/src/Umbraco.Core/Models/RelationItem.cs
@@ -14,7 +14,7 @@ namespace Umbraco.Cms.Core.Models
public Guid NodeKey { get; set; }
[DataMember(Name = "name")]
- public string NodeName { get; set; }
+ public string? NodeName { get; set; }
[DataMember(Name = "type")]
public string NodeType { get; set; }
@@ -23,16 +23,16 @@ namespace Umbraco.Cms.Core.Models
public Udi NodeUdi => Udi.Create(NodeType, NodeKey);
[DataMember(Name = "icon")]
- public string ContentTypeIcon { get; set; }
+ public string? ContentTypeIcon { get; set; }
[DataMember(Name = "alias")]
- public string ContentTypeAlias { get; set; }
+ public string? ContentTypeAlias { get; set; }
[DataMember(Name = "contentTypeName")]
- public string ContentTypeName { get; set; }
+ public string? ContentTypeName { get; set; }
[DataMember(Name = "relationTypeName")]
- public string RelationTypeName { get; set; }
+ public string? RelationTypeName { get; set; }
[DataMember(Name = "relationTypeIsBidirectional")]
public bool RelationTypeIsBidirectional { get; set; }
diff --git a/src/Umbraco.Core/UdiParser.cs b/src/Umbraco.Core/UdiParser.cs
index 427f8ce9f0..4a542e9352 100644
--- a/src/Umbraco.Core/UdiParser.cs
+++ b/src/Umbraco.Core/UdiParser.cs
@@ -74,8 +74,8 @@ namespace Umbraco.Cms.Core
/// The string to convert.
/// An Udi instance that contains the value that was parsed.
/// A boolean value indicating whether the string could be parsed.
- public static bool TryParse(string s, [MaybeNullWhen(returnValue: false)] out T udi)
- where T : Udi
+ public static bool TryParse(string? s, [MaybeNullWhen(returnValue: false)] out T udi)
+ where T : Udi?
{
var result = ParseInternal(s, true, false, out var parsed);
if (result && parsed is T)
@@ -107,7 +107,7 @@ namespace Umbraco.Cms.Core
return ParseInternal(s, true, knownTypes, out udi);
}
- private static bool ParseInternal(string s, bool tryParse, bool knownTypes,[MaybeNullWhen(returnValue: false)] out Udi udi)
+ private static bool ParseInternal(string? s, bool tryParse, bool knownTypes,[MaybeNullWhen(returnValue: false)] out Udi udi)
{
udi = null;
if (Uri.IsWellFormedUriString(s, UriKind.Absolute) == false
diff --git a/src/Umbraco.Infrastructure/Migrations/Upgrade/V_8_0_0/AddTypedLabels.cs b/src/Umbraco.Infrastructure/Migrations/Upgrade/V_8_0_0/AddTypedLabels.cs
index 87d6edbc9f..69431867b1 100644
--- a/src/Umbraco.Infrastructure/Migrations/Upgrade/V_8_0_0/AddTypedLabels.cs
+++ b/src/Umbraco.Infrastructure/Migrations/Upgrade/V_8_0_0/AddTypedLabels.cs
@@ -49,7 +49,7 @@ namespace Umbraco.Cms.Infrastructure.Migrations.Upgrade.V_8_0_0
if (SqlSyntax.SupportsIdentityInsert())
Database.Execute(new Sql($"SET IDENTITY_INSERT {SqlSyntax.GetQuotedTableName(Cms.Core.Constants.DatabaseSchema.Tables.Node)} OFF "));
- void InsertDataTypeDto(int id, string dbType, string configuration = null)
+ void InsertDataTypeDto(int id, string dbType, string? configuration = null)
{
var dataTypeDto = new DataTypeDto
{
@@ -122,7 +122,7 @@ namespace Umbraco.Cms.Infrastructure.Migrations.Upgrade.V_8_0_0
private class PropertyDataValue
{
public int Id { get; set; }
- public string VarcharValue { get;set; }
+ public string? VarcharValue { get;set; }
}
// ReSharper restore UnusedAutoPropertyAccessor.Local
}
diff --git a/src/Umbraco.Infrastructure/Migrations/Upgrade/V_8_0_0/ConvertRelatedLinksToMultiUrlPicker.cs b/src/Umbraco.Infrastructure/Migrations/Upgrade/V_8_0_0/ConvertRelatedLinksToMultiUrlPicker.cs
index 70f5b6f0bf..a6ff99f2c7 100644
--- a/src/Umbraco.Infrastructure/Migrations/Upgrade/V_8_0_0/ConvertRelatedLinksToMultiUrlPicker.cs
+++ b/src/Umbraco.Infrastructure/Migrations/Upgrade/V_8_0_0/ConvertRelatedLinksToMultiUrlPicker.cs
@@ -60,9 +60,14 @@ namespace Umbraco.Cms.Infrastructure.Migrations.Upgrade.V_8_0_0
var relatedLinks = JsonConvert.DeserializeObject>(value);
var links = new List();
+ if (relatedLinks is null)
+ {
+ return;
+ }
+
foreach (var relatedLink in relatedLinks)
{
- GuidUdi udi = null;
+ GuidUdi? udi = null;
if (relatedLink.IsInternal)
{
var linkIsUdi = UdiParser.TryParse(relatedLink.Link, out udi);
@@ -114,9 +119,9 @@ namespace Umbraco.Cms.Infrastructure.Migrations.Upgrade.V_8_0_0
public int? Id { get; internal set; }
internal bool IsDeleted { get; set; }
[JsonProperty("caption")]
- public string Caption { get; set; }
+ public string? Caption { get; set; }
[JsonProperty("link")]
- public string Link { get; set; }
+ public string? Link { get; set; }
[JsonProperty("newWindow")]
public bool NewWindow { get; set; }
[JsonProperty("isInternal")]
@@ -127,15 +132,15 @@ namespace Umbraco.Cms.Infrastructure.Migrations.Upgrade.V_8_0_0
internal class LinkDto
{
[DataMember(Name = "name")]
- public string Name { get; set; }
+ public string? Name { get; set; }
[DataMember(Name = "target")]
- public string Target { get; set; }
+ public string? Target { get; set; }
[DataMember(Name = "udi")]
- public GuidUdi Udi { get; set; }
+ public GuidUdi? Udi { get; set; }
[DataMember(Name = "url")]
- public string Url { get; set; }
+ public string? Url { get; set; }
}
}
diff --git a/src/Umbraco.Infrastructure/Migrations/Upgrade/V_8_0_0/DataTypes/ContentPickerPreValueMigrator.cs b/src/Umbraco.Infrastructure/Migrations/Upgrade/V_8_0_0/DataTypes/ContentPickerPreValueMigrator.cs
index 231c59b315..7e1711604a 100644
--- a/src/Umbraco.Infrastructure/Migrations/Upgrade/V_8_0_0/DataTypes/ContentPickerPreValueMigrator.cs
+++ b/src/Umbraco.Infrastructure/Migrations/Upgrade/V_8_0_0/DataTypes/ContentPickerPreValueMigrator.cs
@@ -5,10 +5,10 @@
public override bool CanMigrate(string editorAlias)
=> editorAlias == Cms.Core.Constants.PropertyEditors.Legacy.Aliases.ContentPicker2;
- public override string GetNewAlias(string editorAlias)
+ public override string? GetNewAlias(string editorAlias)
=> null;
- protected override object GetPreValueValue(PreValueDto preValue)
+ protected override object? GetPreValueValue(PreValueDto preValue)
{
if (preValue.Alias == "showOpenButton" ||
preValue.Alias == "ignoreUserStartNodes")
diff --git a/src/Umbraco.Infrastructure/Migrations/Upgrade/V_8_0_0/DataTypes/DecimalPreValueMigrator.cs b/src/Umbraco.Infrastructure/Migrations/Upgrade/V_8_0_0/DataTypes/DecimalPreValueMigrator.cs
index e5a331cfbe..0383e7029e 100644
--- a/src/Umbraco.Infrastructure/Migrations/Upgrade/V_8_0_0/DataTypes/DecimalPreValueMigrator.cs
+++ b/src/Umbraco.Infrastructure/Migrations/Upgrade/V_8_0_0/DataTypes/DecimalPreValueMigrator.cs
@@ -8,14 +8,14 @@ namespace Umbraco.Cms.Infrastructure.Migrations.Upgrade.V_8_0_0.DataTypes
public override bool CanMigrate(string editorAlias)
=> editorAlias == "Umbraco.Decimal";
- protected override object GetPreValueValue(PreValueDto preValue)
+ protected override object? GetPreValueValue(PreValueDto preValue)
{
if (preValue.Alias == "min" ||
preValue.Alias == "step" ||
preValue.Alias == "max")
return decimal.TryParse(preValue.Value, out var d) ? (decimal?) d : null;
- return preValue.Value.DetectIsJson() ? JsonConvert.DeserializeObject(preValue.Value) : preValue.Value;
+ return preValue.Value?.DetectIsJson() ?? false ? JsonConvert.DeserializeObject(preValue.Value) : preValue.Value;
}
}
}
diff --git a/src/Umbraco.Infrastructure/Migrations/Upgrade/V_8_0_0/DataTypes/DefaultPreValueMigrator.cs b/src/Umbraco.Infrastructure/Migrations/Upgrade/V_8_0_0/DataTypes/DefaultPreValueMigrator.cs
index 0d3b25259c..30507ac3ec 100644
--- a/src/Umbraco.Infrastructure/Migrations/Upgrade/V_8_0_0/DataTypes/DefaultPreValueMigrator.cs
+++ b/src/Umbraco.Infrastructure/Migrations/Upgrade/V_8_0_0/DataTypes/DefaultPreValueMigrator.cs
@@ -11,7 +11,7 @@ namespace Umbraco.Cms.Infrastructure.Migrations.Upgrade.V_8_0_0.DataTypes
public virtual bool CanMigrate(string editorAlias)
=> true;
- public virtual string GetNewAlias(string editorAlias)
+ public virtual string? GetNewAlias(string editorAlias)
=> editorAlias;
public object GetConfiguration(int dataTypeId, string editorAlias, Dictionary preValues)
@@ -35,9 +35,9 @@ namespace Umbraco.Cms.Infrastructure.Migrations.Upgrade.V_8_0_0.DataTypes
protected virtual IEnumerable GetPreValues(IEnumerable preValues)
=> preValues;
- protected virtual object GetPreValueValue(PreValueDto preValue)
+ protected virtual object? GetPreValueValue(PreValueDto preValue)
{
- return preValue.Value.DetectIsJson() ? JsonConvert.DeserializeObject(preValue.Value) : preValue.Value;
+ return preValue.Value?.DetectIsJson() ?? false ? JsonConvert.DeserializeObject(preValue.Value) : preValue.Value;
}
}
}
diff --git a/src/Umbraco.Infrastructure/Migrations/Upgrade/V_8_0_0/DataTypes/DropDownFlexiblePreValueMigrator.cs b/src/Umbraco.Infrastructure/Migrations/Upgrade/V_8_0_0/DataTypes/DropDownFlexiblePreValueMigrator.cs
index fe55844c95..6c0f3d4869 100644
--- a/src/Umbraco.Infrastructure/Migrations/Upgrade/V_8_0_0/DataTypes/DropDownFlexiblePreValueMigrator.cs
+++ b/src/Umbraco.Infrastructure/Migrations/Upgrade/V_8_0_0/DataTypes/DropDownFlexiblePreValueMigrator.cs
@@ -8,7 +8,7 @@ namespace Umbraco.Cms.Infrastructure.Migrations.Upgrade.V_8_0_0.DataTypes
public bool CanMigrate(string editorAlias)
=> editorAlias == "Umbraco.DropDown.Flexible";
- public virtual string GetNewAlias(string editorAlias)
+ public virtual string? GetNewAlias(string editorAlias)
=> null;
public object GetConfiguration(int dataTypeId, string editorAlias, Dictionary preValues)
diff --git a/src/Umbraco.Infrastructure/Migrations/Upgrade/V_8_0_0/DataTypes/IPreValueMigrator.cs b/src/Umbraco.Infrastructure/Migrations/Upgrade/V_8_0_0/DataTypes/IPreValueMigrator.cs
index c6ed38ae16..5489fd626e 100644
--- a/src/Umbraco.Infrastructure/Migrations/Upgrade/V_8_0_0/DataTypes/IPreValueMigrator.cs
+++ b/src/Umbraco.Infrastructure/Migrations/Upgrade/V_8_0_0/DataTypes/IPreValueMigrator.cs
@@ -23,7 +23,7 @@ namespace Umbraco.Cms.Infrastructure.Migrations.Upgrade.V_8_0_0.DataTypes
/// when for instance we know it will fail, and another, later migration will
/// deal with it.
///
- string GetNewAlias(string editorAlias);
+ string? GetNewAlias(string editorAlias);
///
/// Gets the configuration object corresponding to preValue.
diff --git a/src/Umbraco.Infrastructure/Migrations/Upgrade/V_8_0_0/DataTypes/ListViewPreValueMigrator.cs b/src/Umbraco.Infrastructure/Migrations/Upgrade/V_8_0_0/DataTypes/ListViewPreValueMigrator.cs
index 0b9bb4519c..c306e3eef3 100644
--- a/src/Umbraco.Infrastructure/Migrations/Upgrade/V_8_0_0/DataTypes/ListViewPreValueMigrator.cs
+++ b/src/Umbraco.Infrastructure/Migrations/Upgrade/V_8_0_0/DataTypes/ListViewPreValueMigrator.cs
@@ -16,12 +16,14 @@ namespace Umbraco.Cms.Infrastructure.Migrations.Upgrade.V_8_0_0.DataTypes
return preValues.Where(preValue => preValue.Alias != "displayAtTabNumber");
}
- protected override object GetPreValueValue(PreValueDto preValue)
+ protected override object? GetPreValueValue(PreValueDto preValue)
{
if (preValue.Alias == "pageSize")
+ {
return int.TryParse(preValue.Value, NumberStyles.Integer, CultureInfo.InvariantCulture, out var i) ? (int?)i : null;
+ }
- return preValue.Value.DetectIsJson() ? JsonConvert.DeserializeObject(preValue.Value) : preValue.Value;
+ return preValue.Value?.DetectIsJson() ?? false ? JsonConvert.DeserializeObject(preValue.Value) : preValue.Value;
}
}
}
diff --git a/src/Umbraco.Infrastructure/Migrations/Upgrade/V_8_0_0/DataTypes/MarkdownEditorPreValueMigrator.cs b/src/Umbraco.Infrastructure/Migrations/Upgrade/V_8_0_0/DataTypes/MarkdownEditorPreValueMigrator.cs
index 1c0004506a..9f8e7da57a 100644
--- a/src/Umbraco.Infrastructure/Migrations/Upgrade/V_8_0_0/DataTypes/MarkdownEditorPreValueMigrator.cs
+++ b/src/Umbraco.Infrastructure/Migrations/Upgrade/V_8_0_0/DataTypes/MarkdownEditorPreValueMigrator.cs
@@ -5,7 +5,7 @@
public override bool CanMigrate(string editorAlias)
=> editorAlias == Cms.Core.Constants.PropertyEditors.Aliases.MarkdownEditor;
- protected override object GetPreValueValue(PreValueDto preValue)
+ protected override object? GetPreValueValue(PreValueDto preValue)
{
if (preValue.Alias == "preview")
return preValue.Value == "1";
diff --git a/src/Umbraco.Infrastructure/Migrations/Upgrade/V_8_0_0/DataTypes/MediaPickerPreValueMigrator.cs b/src/Umbraco.Infrastructure/Migrations/Upgrade/V_8_0_0/DataTypes/MediaPickerPreValueMigrator.cs
index 39b67984c8..364cc3e86b 100644
--- a/src/Umbraco.Infrastructure/Migrations/Upgrade/V_8_0_0/DataTypes/MediaPickerPreValueMigrator.cs
+++ b/src/Umbraco.Infrastructure/Migrations/Upgrade/V_8_0_0/DataTypes/MediaPickerPreValueMigrator.cs
@@ -24,7 +24,7 @@ namespace Umbraco.Cms.Infrastructure.Migrations.Upgrade.V_8_0_0.DataTypes
}
*/
- protected override object GetPreValueValue(PreValueDto preValue)
+ protected override object? GetPreValueValue(PreValueDto preValue)
{
if (preValue.Alias == "multiPicker" ||
preValue.Alias == "onlyImages" ||
diff --git a/src/Umbraco.Infrastructure/Migrations/Upgrade/V_8_0_0/DataTypes/NestedContentPreValueMigrator.cs b/src/Umbraco.Infrastructure/Migrations/Upgrade/V_8_0_0/DataTypes/NestedContentPreValueMigrator.cs
index 98eac62f15..761f55be4e 100644
--- a/src/Umbraco.Infrastructure/Migrations/Upgrade/V_8_0_0/DataTypes/NestedContentPreValueMigrator.cs
+++ b/src/Umbraco.Infrastructure/Migrations/Upgrade/V_8_0_0/DataTypes/NestedContentPreValueMigrator.cs
@@ -17,7 +17,7 @@ namespace Umbraco.Cms.Infrastructure.Migrations.Upgrade.V_8_0_0.DataTypes
}
*/
- protected override object GetPreValueValue(PreValueDto preValue)
+ protected override object? GetPreValueValue(PreValueDto preValue)
{
if (preValue.Alias == "confirmDeletes" ||
preValue.Alias == "showIcons" ||
@@ -28,7 +28,7 @@ namespace Umbraco.Cms.Infrastructure.Migrations.Upgrade.V_8_0_0.DataTypes
preValue.Alias == "maxItems")
return int.TryParse(preValue.Value, NumberStyles.Integer, CultureInfo.InvariantCulture, out var i) ? (int?)i : null;
- return preValue.Value.DetectIsJson() ? JsonConvert.DeserializeObject(preValue.Value) : preValue.Value;
+ return preValue.Value?.DetectIsJson() ?? false ? JsonConvert.DeserializeObject(preValue.Value) : preValue.Value;
}
}
}
diff --git a/src/Umbraco.Infrastructure/Migrations/Upgrade/V_8_0_0/DataTypes/PreValueDto.cs b/src/Umbraco.Infrastructure/Migrations/Upgrade/V_8_0_0/DataTypes/PreValueDto.cs
index 0531d571f3..d3f4b06737 100644
--- a/src/Umbraco.Infrastructure/Migrations/Upgrade/V_8_0_0/DataTypes/PreValueDto.cs
+++ b/src/Umbraco.Infrastructure/Migrations/Upgrade/V_8_0_0/DataTypes/PreValueDto.cs
@@ -13,12 +13,12 @@ namespace Umbraco.Cms.Infrastructure.Migrations.Upgrade.V_8_0_0.DataTypes
public int NodeId { get; set; }
[Column("alias")]
- public string Alias { get; set; }
+ public string Alias { get; set; } = null!;
[Column("sortorder")]
public int SortOrder { get; set; }
[Column("value")]
- public string Value { get; set; }
+ public string? Value { get; set; }
}
}
diff --git a/src/Umbraco.Infrastructure/Migrations/Upgrade/V_8_0_0/DataTypes/PreValueMigratorCollection.cs b/src/Umbraco.Infrastructure/Migrations/Upgrade/V_8_0_0/DataTypes/PreValueMigratorCollection.cs
index ca4ec9bfe1..b304098188 100644
--- a/src/Umbraco.Infrastructure/Migrations/Upgrade/V_8_0_0/DataTypes/PreValueMigratorCollection.cs
+++ b/src/Umbraco.Infrastructure/Migrations/Upgrade/V_8_0_0/DataTypes/PreValueMigratorCollection.cs
@@ -17,7 +17,7 @@ namespace Umbraco.Cms.Infrastructure.Migrations.Upgrade.V_8_0_0.DataTypes
_logger = logger;
}
- public IPreValueMigrator GetMigrator(string editorAlias)
+ public IPreValueMigrator? GetMigrator(string editorAlias)
{
var migrator = this.FirstOrDefault(x => x.CanMigrate(editorAlias));
_logger.LogDebug("Getting migrator for \"{EditorAlias}\" = {MigratorType}", editorAlias, migrator == null ? "" : migrator.GetType().Name);
diff --git a/src/Umbraco.Infrastructure/Migrations/Upgrade/V_8_0_0/DataTypes/RichTextPreValueMigrator.cs b/src/Umbraco.Infrastructure/Migrations/Upgrade/V_8_0_0/DataTypes/RichTextPreValueMigrator.cs
index 1f704e0b3d..0abcd86a96 100644
--- a/src/Umbraco.Infrastructure/Migrations/Upgrade/V_8_0_0/DataTypes/RichTextPreValueMigrator.cs
+++ b/src/Umbraco.Infrastructure/Migrations/Upgrade/V_8_0_0/DataTypes/RichTextPreValueMigrator.cs
@@ -11,12 +11,12 @@ namespace Umbraco.Cms.Infrastructure.Migrations.Upgrade.V_8_0_0.DataTypes
public override string GetNewAlias(string editorAlias)
=> Cms.Core.Constants.PropertyEditors.Aliases.TinyMce;
- protected override object GetPreValueValue(PreValueDto preValue)
+ protected override object? GetPreValueValue(PreValueDto preValue)
{
if (preValue.Alias == "hideLabel")
return preValue.Value == "1";
- return preValue.Value.DetectIsJson() ? JsonConvert.DeserializeObject(preValue.Value) : preValue.Value;
+ return preValue.Value?.DetectIsJson() ?? false ? JsonConvert.DeserializeObject(preValue.Value) : preValue.Value;
}
}
}
diff --git a/src/Umbraco.Infrastructure/Migrations/Upgrade/V_8_0_0/DataTypes/ValueListPreValueMigrator.cs b/src/Umbraco.Infrastructure/Migrations/Upgrade/V_8_0_0/DataTypes/ValueListPreValueMigrator.cs
index be6b270048..44b12addd2 100644
--- a/src/Umbraco.Infrastructure/Migrations/Upgrade/V_8_0_0/DataTypes/ValueListPreValueMigrator.cs
+++ b/src/Umbraco.Infrastructure/Migrations/Upgrade/V_8_0_0/DataTypes/ValueListPreValueMigrator.cs
@@ -19,7 +19,7 @@ namespace Umbraco.Cms.Infrastructure.Migrations.Upgrade.V_8_0_0.DataTypes
public bool CanMigrate(string editorAlias)
=> _editors.Contains(editorAlias);
- public virtual string GetNewAlias(string editorAlias)
+ public virtual string? GetNewAlias(string editorAlias)
=> null;
public object GetConfiguration(int dataTypeId, string editorAlias, Dictionary preValues)
diff --git a/src/Umbraco.Infrastructure/Migrations/Upgrade/V_8_0_0/DropDownPropertyEditorsMigration.cs b/src/Umbraco.Infrastructure/Migrations/Upgrade/V_8_0_0/DropDownPropertyEditorsMigration.cs
index a03c87159b..b4f6b5cf9d 100644
--- a/src/Umbraco.Infrastructure/Migrations/Upgrade/V_8_0_0/DropDownPropertyEditorsMigration.cs
+++ b/src/Umbraco.Infrastructure/Migrations/Upgrade/V_8_0_0/DropDownPropertyEditorsMigration.cs
@@ -37,7 +37,7 @@ namespace Umbraco.Cms.Infrastructure.Migrations.Upgrade.V_8_0_0
private bool Migrate(IEnumerable dataTypes)
{
var refreshCache = false;
- ConfigurationEditor configurationEditor = null;
+ ConfigurationEditor? configurationEditor = null;
foreach (var dataType in dataTypes)
{
diff --git a/src/Umbraco.Infrastructure/Migrations/Upgrade/V_8_0_0/Models/ContentTypeDto80.cs b/src/Umbraco.Infrastructure/Migrations/Upgrade/V_8_0_0/Models/ContentTypeDto80.cs
index 9328e774e1..bbd1646ad5 100644
--- a/src/Umbraco.Infrastructure/Migrations/Upgrade/V_8_0_0/Models/ContentTypeDto80.cs
+++ b/src/Umbraco.Infrastructure/Migrations/Upgrade/V_8_0_0/Models/ContentTypeDto80.cs
@@ -29,21 +29,21 @@ namespace Umbraco.Cms.Infrastructure.Migrations.Upgrade.V_8_0_0.Models
[Column("alias")]
[NullSetting(NullSetting = NullSettings.Null)]
- public string Alias { get; set; }
+ public string? Alias { get; set; }
[Column("icon")]
[Index(IndexTypes.NonClustered)]
[NullSetting(NullSetting = NullSettings.Null)]
- public string Icon { get; set; }
+ public string? Icon { get; set; }
[Column("thumbnail")]
[Constraint(Default = "folder.png")]
- public string Thumbnail { get; set; }
+ public string? Thumbnail { get; set; }
[Column("description")]
[NullSetting(NullSetting = NullSettings.Null)]
[Length(1500)]
- public string Description { get; set; }
+ public string? Description { get; set; }
[Column("isContainer")]
[Constraint(Default = "0")]
@@ -58,6 +58,6 @@ namespace Umbraco.Cms.Infrastructure.Migrations.Upgrade.V_8_0_0.Models
public byte Variations { get; set; }
[ResultColumn]
- public NodeDto NodeDto { get; set; }
+ public NodeDto? NodeDto { get; set; }
}
}
diff --git a/src/Umbraco.Infrastructure/Migrations/Upgrade/V_8_0_0/Models/PropertyDataDto80.cs b/src/Umbraco.Infrastructure/Migrations/Upgrade/V_8_0_0/Models/PropertyDataDto80.cs
index 69aabd4e21..1e9e93aa53 100644
--- a/src/Umbraco.Infrastructure/Migrations/Upgrade/V_8_0_0/Models/PropertyDataDto80.cs
+++ b/src/Umbraco.Infrastructure/Migrations/Upgrade/V_8_0_0/Models/PropertyDataDto80.cs
@@ -48,7 +48,7 @@ namespace Umbraco.Cms.Infrastructure.Migrations.Upgrade.V_8_0_0.Models
[Index(IndexTypes.NonClustered, Name = "IX_" + TableName + "_Segment")]
[NullSetting(NullSetting = NullSettings.Null)]
[Length(SegmentLength)]
- public string Segment { get; set; }
+ public string? Segment { get; set; }
[Column("intValue")]
[NullSetting(NullSetting = NullSettings.Null)]
@@ -69,19 +69,19 @@ namespace Umbraco.Cms.Infrastructure.Migrations.Upgrade.V_8_0_0.Models
[Column("varcharValue")]
[NullSetting(NullSetting = NullSettings.Null)]
[Length(VarcharLength)]
- public string VarcharValue { get; set; }
+ public string? VarcharValue { get; set; }
[Column("textValue")]
[NullSetting(NullSetting = NullSettings.Null)]
[SpecialDbType(SpecialDbTypes.NTEXT)]
- public string TextValue { get; set; }
+ public string? TextValue { get; set; }
[ResultColumn]
[Reference(ReferenceType.OneToOne, ColumnName = "PropertyTypeId")]
- public PropertyTypeDto80 PropertyTypeDto { get; set; }
+ public PropertyTypeDto80? PropertyTypeDto { get; set; }
[Ignore]
- public object Value
+ public object? Value
{
get
{
diff --git a/src/Umbraco.Infrastructure/Migrations/Upgrade/V_8_0_0/Models/PropertyTypeDto80.cs b/src/Umbraco.Infrastructure/Migrations/Upgrade/V_8_0_0/Models/PropertyTypeDto80.cs
index 485be0d3b0..4d61521d00 100644
--- a/src/Umbraco.Infrastructure/Migrations/Upgrade/V_8_0_0/Models/PropertyTypeDto80.cs
+++ b/src/Umbraco.Infrastructure/Migrations/Upgrade/V_8_0_0/Models/PropertyTypeDto80.cs
@@ -36,11 +36,11 @@ namespace Umbraco.Cms.Infrastructure.Migrations.Upgrade.V_8_0_0.Models
[Index(IndexTypes.NonClustered, Name = "IX_cmsPropertyTypeAlias")]
[Column("Alias")]
- public string Alias { get; set; }
+ public string Alias { get; set; } = null!;
[Column("Name")]
[NullSetting(NullSetting = NullSettings.Null)]
- public string Name { get; set; }
+ public string? Name { get; set; }
[Column("sortOrder")]
[Constraint(Default = "0")]
@@ -52,12 +52,12 @@ namespace Umbraco.Cms.Infrastructure.Migrations.Upgrade.V_8_0_0.Models
[Column("validationRegExp")]
[NullSetting(NullSetting = NullSettings.Null)]
- public string ValidationRegExp { get; set; }
+ public string? ValidationRegExp { get; set; }
[Column("Description")]
[NullSetting(NullSetting = NullSettings.Null)]
[Length(2000)]
- public string Description { get; set; }
+ public string? Description { get; set; }
[Column("variations")]
[Constraint(Default = "1" /*ContentVariation.InvariantNeutral*/)]
@@ -65,7 +65,7 @@ namespace Umbraco.Cms.Infrastructure.Migrations.Upgrade.V_8_0_0.Models
[ResultColumn]
[Reference(ReferenceType.OneToOne, ColumnName = "DataTypeId")]
- public DataTypeDto DataTypeDto { get; set; }
+ public DataTypeDto? DataTypeDto { get; set; }
[Column("UniqueID")]
[NullSetting(NullSetting = NullSettings.NotNull)]
diff --git a/src/Umbraco.Infrastructure/Migrations/Upgrade/V_8_0_0/PropertyEditorsMigrationBase.cs b/src/Umbraco.Infrastructure/Migrations/Upgrade/V_8_0_0/PropertyEditorsMigrationBase.cs
index f24cfc1142..92f2e7d4b5 100644
--- a/src/Umbraco.Infrastructure/Migrations/Upgrade/V_8_0_0/PropertyEditorsMigrationBase.cs
+++ b/src/Umbraco.Infrastructure/Migrations/Upgrade/V_8_0_0/PropertyEditorsMigrationBase.cs
@@ -31,17 +31,17 @@ namespace Umbraco.Cms.Infrastructure.Migrations.Upgrade.V_8_0_0
return Database.Fetch(sql);
}
- protected int[] ConvertStringValues(string val)
+ protected int[]? ConvertStringValues(string? val)
{
- var splitVals = val.Split(Constants.CharArrays.Comma, StringSplitOptions.RemoveEmptyEntries);
+ var splitVals = val?.Split(Constants.CharArrays.Comma, StringSplitOptions.RemoveEmptyEntries);
- var intVals = splitVals
+ var intVals = splitVals?
.Select(x => int.TryParse(x, NumberStyles.Integer, CultureInfo.InvariantCulture, out var i) ? i : int.MinValue)
.Where(x => x != int.MinValue)
.ToArray();
//only return if the number of values are the same (i.e. All INTs)
- if (splitVals.Length == intVals.Length)
+ if (splitVals?.Length == intVals?.Length)
return intVals;
return null;
@@ -50,7 +50,7 @@ namespace Umbraco.Cms.Infrastructure.Migrations.Upgrade.V_8_0_0
internal bool UpdatePropertyDataDto(PropertyDataDto propData, ValueListConfiguration config, bool isMultiple)
{
//Get the INT ids stored for this property/drop down
- int[] ids = null;
+ int[]? ids = null;
if (!propData.VarcharValue.IsNullOrWhiteSpace())
{
ids = ConvertStringValues(propData.VarcharValue);
@@ -74,7 +74,7 @@ namespace Umbraco.Cms.Infrastructure.Migrations.Upgrade.V_8_0_0
foreach (var id in ids)
{
var val = config.Items.FirstOrDefault(x => x.Id == id);
- if (val != null)
+ if (val?.Value != null)
{
values.Add(val.Value);
continue;
diff --git a/src/Umbraco.Infrastructure/Migrations/Upgrade/V_8_0_0/RadioAndCheckboxPropertyEditorsMigration.cs b/src/Umbraco.Infrastructure/Migrations/Upgrade/V_8_0_0/RadioAndCheckboxPropertyEditorsMigration.cs
index 1dc0b7f2c3..f462510a2a 100644
--- a/src/Umbraco.Infrastructure/Migrations/Upgrade/V_8_0_0/RadioAndCheckboxPropertyEditorsMigration.cs
+++ b/src/Umbraco.Infrastructure/Migrations/Upgrade/V_8_0_0/RadioAndCheckboxPropertyEditorsMigration.cs
@@ -43,7 +43,7 @@ namespace Umbraco.Cms.Infrastructure.Migrations.Upgrade.V_8_0_0
private bool Migrate(IEnumerable dataTypes, bool isMultiple)
{
var refreshCache = false;
- ConfigurationEditor configurationEditor = null;
+ ConfigurationEditor? configurationEditor = null;
foreach (var dataType in dataTypes)
{
diff --git a/src/Umbraco.Infrastructure/Migrations/Upgrade/V_8_0_0/RefactorVariantsModel.cs b/src/Umbraco.Infrastructure/Migrations/Upgrade/V_8_0_0/RefactorVariantsModel.cs
index a7759e557c..1ff19e0698 100644
--- a/src/Umbraco.Infrastructure/Migrations/Upgrade/V_8_0_0/RefactorVariantsModel.cs
+++ b/src/Umbraco.Infrastructure/Migrations/Upgrade/V_8_0_0/RefactorVariantsModel.cs
@@ -73,7 +73,7 @@ namespace Umbraco.Cms.Infrastructure.Migrations.Upgrade.V_8_0_0
{
public int NodeId { get; set; }
public int LanguageId { get; set; }
- public string Name { get; set; }
+ public string? Name { get; set; }
}
// ReSharper restore UnusedAutoPropertyAccessor.Local
}
diff --git a/src/Umbraco.Infrastructure/Migrations/Upgrade/V_8_0_0/UpdatePickerIntegerValuesToUdi.cs b/src/Umbraco.Infrastructure/Migrations/Upgrade/V_8_0_0/UpdatePickerIntegerValuesToUdi.cs
index 3cbc7357e5..7fe50b2159 100644
--- a/src/Umbraco.Infrastructure/Migrations/Upgrade/V_8_0_0/UpdatePickerIntegerValuesToUdi.cs
+++ b/src/Umbraco.Infrastructure/Migrations/Upgrade/V_8_0_0/UpdatePickerIntegerValuesToUdi.cs
@@ -32,8 +32,8 @@ namespace Umbraco.Cms.Infrastructure.Migrations.Upgrade.V_8_0_0
case Cms.Core.Constants.PropertyEditors.Aliases.ContentPicker:
case Cms.Core.Constants.PropertyEditors.Aliases.MediaPicker:
{
- var config = JsonConvert.DeserializeObject(datatype.Configuration);
- var startNodeId = config.Value("startNodeId");
+ var config = JsonConvert.DeserializeObject(datatype.Configuration!);
+ var startNodeId = config!.Value("startNodeId");
if (!startNodeId.IsNullOrWhiteSpace() && int.TryParse(startNodeId, NumberStyles.Integer, CultureInfo.InvariantCulture, out var intStartNode))
{
var guid = intStartNode <= 0
@@ -45,10 +45,10 @@ namespace Umbraco.Cms.Infrastructure.Migrations.Upgrade.V_8_0_0
var udi = new GuidUdi(datatype.EditorAlias == Cms.Core.Constants.PropertyEditors.Aliases.MediaPicker
? Cms.Core.Constants.UdiEntityType.Media
: Cms.Core.Constants.UdiEntityType.Document, guid.Value);
- config["startNodeId"] = new JValue(udi.ToString());
+ config!["startNodeId"] = new JValue(udi.ToString());
}
else
- config.Remove("startNodeId");
+ config!.Remove("startNodeId");
datatype.Configuration = JsonConvert.SerializeObject(config);
Database.Update(datatype);
@@ -58,8 +58,8 @@ namespace Umbraco.Cms.Infrastructure.Migrations.Upgrade.V_8_0_0
}
case Cms.Core.Constants.PropertyEditors.Aliases.MultiNodeTreePicker:
{
- var config = JsonConvert.DeserializeObject(datatype.Configuration);
- var startNodeConfig = config.Value("startNode");
+ var config = JsonConvert.DeserializeObject(datatype.Configuration!);
+ var startNodeConfig = config!.Value("startNode");
if (startNodeConfig != null)
{
var startNodeId = startNodeConfig.Value("id");
@@ -73,8 +73,8 @@ namespace Umbraco.Cms.Infrastructure.Migrations.Upgrade.V_8_0_0
: Context.Database.ExecuteScalar(
Sql().Select(x => x.UniqueId).From().Where(x => x.NodeId == intStartNode));
- string entityType = null;
- switch (objectType.ToLowerInvariant())
+ string? entityType = null;
+ switch (objectType?.ToLowerInvariant())
{
case "content":
entityType = Cms.Core.Constants.UdiEntityType.Document;
diff --git a/src/Umbraco.Infrastructure/Migrations/Upgrade/V_8_15_0/AddCmsContentNuByteColumn.cs b/src/Umbraco.Infrastructure/Migrations/Upgrade/V_8_15_0/AddCmsContentNuByteColumn.cs
index 10db1964e0..23bb979dd9 100644
--- a/src/Umbraco.Infrastructure/Migrations/Upgrade/V_8_15_0/AddCmsContentNuByteColumn.cs
+++ b/src/Umbraco.Infrastructure/Migrations/Upgrade/V_8_15_0/AddCmsContentNuByteColumn.cs
@@ -38,7 +38,7 @@ namespace Umbraco.Cms.Infrastructure.Migrations.Upgrade.V_8_15_0
[Column("data")]
[SpecialDbType(SpecialDbTypes.NTEXT)]
[NullSetting(NullSetting = NullSettings.Null)]
- public string Data { get; set; }
+ public string? Data { get; set; }
[Column("rv")]
public long Rv { get; set; }
diff --git a/src/Umbraco.Infrastructure/Migrations/Upgrade/V_8_17_0/AddPropertyTypeGroupColumns.cs b/src/Umbraco.Infrastructure/Migrations/Upgrade/V_8_17_0/AddPropertyTypeGroupColumns.cs
index 9230987389..feedc56d9a 100644
--- a/src/Umbraco.Infrastructure/Migrations/Upgrade/V_8_17_0/AddPropertyTypeGroupColumns.cs
+++ b/src/Umbraco.Infrastructure/Migrations/Upgrade/V_8_17_0/AddPropertyTypeGroupColumns.cs
@@ -33,7 +33,7 @@ namespace Umbraco.Cms.Infrastructure.Migrations.Upgrade.V_8_17_0
internal IEnumerable PopulateAliases(IEnumerable dtos)
{
- foreach (var dtosPerAlias in dtos.GroupBy(x => x.Text.ToSafeAlias(_shortStringHelper, true)))
+ foreach (var dtosPerAlias in dtos.GroupBy(x => x.Text?.ToSafeAlias(_shortStringHelper, true)))
{
var dtosPerAliasAndText = dtosPerAlias.GroupBy(x => x.Text);
var numberSuffix = 1;
@@ -41,7 +41,7 @@ namespace Umbraco.Cms.Infrastructure.Migrations.Upgrade.V_8_17_0
{
foreach (var dto in dtosPerText)
{
- dto.Alias = dtosPerAlias.Key;
+ dto.Alias = dtosPerAlias.Key ?? string.Empty;
if (numberSuffix > 1)
{
diff --git a/src/Umbraco.Infrastructure/Migrations/Upgrade/V_8_1_0/ConvertTinyMceAndGridMediaUrlsToLocalLink.cs b/src/Umbraco.Infrastructure/Migrations/Upgrade/V_8_1_0/ConvertTinyMceAndGridMediaUrlsToLocalLink.cs
index e0f2fb3831..96d60a30e5 100644
--- a/src/Umbraco.Infrastructure/Migrations/Upgrade/V_8_1_0/ConvertTinyMceAndGridMediaUrlsToLocalLink.cs
+++ b/src/Umbraco.Infrastructure/Migrations/Upgrade/V_8_1_0/ConvertTinyMceAndGridMediaUrlsToLocalLink.cs
@@ -28,7 +28,7 @@ namespace Umbraco.Cms.Infrastructure.Migrations.Upgrade.V_8_1_0
RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.IgnorePatternWhitespace);
var sqlPropertyData = Sql()
- .Select(r => r.Select(x => x.PropertyTypeDto, r1 => r1.Select(x => x.DataTypeDto)))
+ .Select(r => r.Select(x => x.PropertyTypeDto, r1 => r1.Select(x => x!.DataTypeDto)))
.From()
.InnerJoin().On((left, right) => left.PropertyTypeId == right.Id)
.InnerJoin().On((left, right) => left.DataTypeId == right.NodeId)
@@ -46,7 +46,7 @@ namespace Umbraco.Cms.Infrastructure.Migrations.Upgrade.V_8_1_0
bool propertyChanged = false;
- if (property.PropertyTypeDto.DataTypeDto.EditorAlias == Cms.Core.Constants.PropertyEditors.Aliases.Grid)
+ if (property.PropertyTypeDto?.DataTypeDto?.EditorAlias == Cms.Core.Constants.PropertyEditors.Aliases.Grid)
{
try
{
diff --git a/src/Umbraco.Infrastructure/Persistence/ScalarMapper.cs b/src/Umbraco.Infrastructure/Persistence/ScalarMapper.cs
index 9b6eada924..827aef1932 100644
--- a/src/Umbraco.Infrastructure/Persistence/ScalarMapper.cs
+++ b/src/Umbraco.Infrastructure/Persistence/ScalarMapper.cs
@@ -10,5 +10,5 @@ public abstract class ScalarMapper : IScalarMapper
protected abstract T Map(object value);
///
- object IScalarMapper.Map(object value) => Map(value);
+ object IScalarMapper.Map(object value) => Map(value)!;
}
diff --git a/src/Umbraco.Infrastructure/Routing/RedirectTrackingHandler.cs b/src/Umbraco.Infrastructure/Routing/RedirectTrackingHandler.cs
index 4b34cf41a9..dabee6db9d 100644
--- a/src/Umbraco.Infrastructure/Routing/RedirectTrackingHandler.cs
+++ b/src/Umbraco.Infrastructure/Routing/RedirectTrackingHandler.cs
@@ -100,7 +100,7 @@ namespace Umbraco.Cms.Core.Routing
return;
}
- IPublishedContentCache contentCache = publishedSnapshot?.Content;
+ IPublishedContentCache? contentCache = publishedSnapshot?.Content;
IPublishedContent? entityContent = contentCache?.GetById(entity.Id);
if (entityContent is null)
{
diff --git a/src/Umbraco.Infrastructure/Scoping/Scope.cs b/src/Umbraco.Infrastructure/Scoping/Scope.cs
index 008556225b..59d6f83022 100644
--- a/src/Umbraco.Infrastructure/Scoping/Scope.cs
+++ b/src/Umbraco.Infrastructure/Scoping/Scope.cs
@@ -53,7 +53,7 @@ namespace Umbraco.Cms.Core.Scoping
private Dictionary>? _readLocksDictionary;
private HashSet? _writeLocks;
private Dictionary>? _writeLocksDictionary;
- private Queue _acquiredLocks;
+ private Queue? _acquiredLocks;
// initializes a new scope
private Scope(
@@ -450,7 +450,7 @@ namespace Umbraco.Cms.Core.Scoping
{
while (!_acquiredLocks?.IsCollectionEmpty() ?? false)
{
- _acquiredLocks.Dequeue().Dispose();
+ _acquiredLocks?.Dequeue().Dispose();
}
// We're the parent scope, make sure that locks of all scopes has been cleared
@@ -1104,7 +1104,7 @@ namespace Umbraco.Cms.Core.Scoping
{
// Something went wrong and we didn't get the lock
// Since we at this point have determined that we haven't got any lock with an ID of LockID, it's safe to completely remove it instead of decrementing.
- locks[instanceId].Remove(lockId);
+ locks?[instanceId].Remove(lockId);
// It needs to be removed from the HashSet as well, because that's how we determine to acquire a lock.
locksSet.Remove(lockId);
@@ -1118,7 +1118,7 @@ namespace Umbraco.Cms.Core.Scoping
/// Lock object identifier to lock.
/// TimeSpan specifying the timout period.
private void ObtainReadLock(int lockId, TimeSpan? timeout)
- => _acquiredLocks.Enqueue(_scopeProvider.DistributedLockingMechanismFactory.DistributedLockingMechanism.ReadLock(lockId, timeout));
+ => _acquiredLocks?.Enqueue(_scopeProvider.DistributedLockingMechanismFactory.DistributedLockingMechanism!.ReadLock(lockId, timeout));
///
/// Obtains a write lock with a custom timeout.
@@ -1126,6 +1126,6 @@ namespace Umbraco.Cms.Core.Scoping
/// Lock object identifier to lock.
/// TimeSpan specifying the timout period.
private void ObtainWriteLock(int lockId, TimeSpan? timeout)
- => _acquiredLocks.Enqueue(_scopeProvider.DistributedLockingMechanismFactory.DistributedLockingMechanism.WriteLock(lockId, timeout));
+ => _acquiredLocks?.Enqueue(_scopeProvider.DistributedLockingMechanismFactory.DistributedLockingMechanism!.WriteLock(lockId, timeout));
}
}
diff --git a/src/Umbraco.Infrastructure/Security/MemberUserStore.cs b/src/Umbraco.Infrastructure/Security/MemberUserStore.cs
index 1b660ebf4e..e8d93d9221 100644
--- a/src/Umbraco.Infrastructure/Security/MemberUserStore.cs
+++ b/src/Umbraco.Infrastructure/Security/MemberUserStore.cs
@@ -574,7 +574,7 @@ namespace Umbraco.Cms.Core.Security
throw new ArgumentNullException(nameof(user));
}
- IIdentityUserToken token = user.LoginTokens.FirstOrDefault(x => x.LoginProvider.InvariantEquals(loginProvider) && x.Name.InvariantEquals(name));
+ IIdentityUserToken? token = user.LoginTokens.FirstOrDefault(x => x.LoginProvider.InvariantEquals(loginProvider) && x.Name.InvariantEquals(name));
if (token == null)
{
user.LoginTokens.Add(new IdentityUserToken(loginProvider, name, value, user.Id));
@@ -587,7 +587,7 @@ namespace Umbraco.Cms.Core.Security
return Task.CompletedTask;
}
- private MemberIdentityUser AssignLoginsCallback(MemberIdentityUser? user)
+ private MemberIdentityUser? AssignLoginsCallback(MemberIdentityUser? user)
{
if (user != null)
{