Add nullability to nucache & lucene projects
This commit is contained in:
@@ -5,7 +5,7 @@ namespace Umbraco.Cms.Infrastructure.PublishedCache.Navigable
|
||||
{
|
||||
internal interface INavigableData
|
||||
{
|
||||
IPublishedContent GetById(bool preview, int contentId);
|
||||
IPublishedContent? GetById(bool preview, int contentId);
|
||||
IEnumerable<IPublishedContent> GetAtRoot(bool preview);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ namespace Umbraco.Cms.Infrastructure.PublishedCache.Navigable
|
||||
internal class NavigableContent : INavigableContent
|
||||
{
|
||||
private readonly PublishedContent _content;
|
||||
private readonly string[] _builtInValues;
|
||||
private readonly string?[] _builtInValues;
|
||||
|
||||
public NavigableContent(IPublishedContent content)
|
||||
{
|
||||
@@ -33,7 +33,7 @@ namespace Umbraco.Cms.Infrastructure.PublishedCache.Navigable
|
||||
};
|
||||
}
|
||||
|
||||
private string XmlString(int index, object value)
|
||||
private string? XmlString(int index, object? value)
|
||||
{
|
||||
if (value == null) return string.Empty;
|
||||
var field = Type.FieldTypes[index];
|
||||
@@ -51,9 +51,9 @@ namespace Umbraco.Cms.Infrastructure.PublishedCache.Navigable
|
||||
public INavigableContentType Type => NavigableContentType.GetContentType(_content.ContentType);
|
||||
|
||||
// returns all child ids, will be filtered by the source
|
||||
public IList<int> ChildIds => _content.ChildIds;
|
||||
public IList<int>? ChildIds => _content.ChildIds;
|
||||
|
||||
public object Value(int index)
|
||||
public object? Value(int index)
|
||||
{
|
||||
if (index < 0)
|
||||
throw new ArgumentOutOfRangeException(nameof(index));
|
||||
|
||||
@@ -14,7 +14,9 @@ namespace Umbraco.Cms.Infrastructure.PublishedCache.Navigable
|
||||
|
||||
// called by the conditional weak table -- must be public
|
||||
// ReSharper disable EmptyConstructor
|
||||
#pragma warning disable CS8618
|
||||
public NavigableContentType()
|
||||
#pragma warning restore CS8618
|
||||
// ReSharper restore EmptyConstructor
|
||||
{ }
|
||||
|
||||
|
||||
@@ -5,13 +5,13 @@ namespace Umbraco.Cms.Infrastructure.PublishedCache.Navigable
|
||||
{
|
||||
internal class NavigablePropertyType : INavigableFieldType
|
||||
{
|
||||
public NavigablePropertyType(string name, Func<object, string> xmlStringConverter = null)
|
||||
public NavigablePropertyType(string name, Func<object, string>? xmlStringConverter = null)
|
||||
{
|
||||
Name = name;
|
||||
XmlStringConverter = xmlStringConverter;
|
||||
}
|
||||
|
||||
public string Name { get; }
|
||||
public Func<object, string> XmlStringConverter { get; }
|
||||
public Func<object, string>? XmlStringConverter { get; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ namespace Umbraco.Cms.Infrastructure.PublishedCache.Navigable
|
||||
|
||||
public IList<int> ChildIds => _childIds;
|
||||
|
||||
public object Value(int index)
|
||||
public object? Value(int index)
|
||||
{
|
||||
// only id has a value
|
||||
return index == 0 ? "-1" : null;
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace Umbraco.Cms.Infrastructure.PublishedCache.Navigable
|
||||
_root = new RootContent(contentAtRoot.Select(x => x.Id));
|
||||
}
|
||||
|
||||
public INavigableContent Get(int id)
|
||||
public INavigableContent? Get(int id)
|
||||
{
|
||||
// wrap in a navigable content
|
||||
|
||||
|
||||
Reference in New Issue
Block a user