Few more NRT tweaks (#12323)

* Amended GetAll() on IDataTypeService to return an empty collection rather than null.

* Added a ClearSessionValue method to ISessionManager (given you can no longer set a value to null).

* Allow for null values in a StatefulNotification.

* Removed obsoletion of synchronous messages on TreeControllerBase.

* Fixed further CS8620 warnings in core project.

* Further fix to nullable warning.

* Aligned nullablility of retreiving tree nodes and menus, synchronously or asynchronously (such that we no longer can get null values, always empty collection objects).
This commit is contained in:
Andy Butland
2022-05-01 08:18:09 +02:00
committed by GitHub
parent d47ae6868b
commit 96d33201aa
31 changed files with 102 additions and 77 deletions

View File

@@ -4,6 +4,6 @@ namespace Umbraco.Cms.Core.Notifications
{
public interface IStatefulNotification : INotification
{
IDictionary<string, object> State { get; set; }
IDictionary<string, object?> State { get; set; }
}
}

View File

@@ -4,7 +4,7 @@ namespace Umbraco.Cms.Core.Notifications
{
public static class NotificationExtensions
{
public static T WithState<T>(this T notification, IDictionary<string, object>? state) where T : IStatefulNotification
public static T WithState<T>(this T notification, IDictionary<string, object?>? state) where T : IStatefulNotification
{
notification.State = state!;
return notification;

View File

@@ -6,15 +6,15 @@ namespace Umbraco.Cms.Core.Notifications
{
public abstract class StatefulNotification : IStatefulNotification
{
private IDictionary<string, object>? _state;
private IDictionary<string, object?>? _state;
/// <summary>
/// This can be used by event subscribers to store state in the notification so they easily deal with custom state data between
/// a starting ("ing") and an ending ("ed") notification
/// </summary>
public IDictionary<string, object> State
public IDictionary<string, object?> State
{
get => _state ??= new Dictionary<string, object>();
get => _state ??= new Dictionary<string, object?>();
set => _state = value;
}
}