diff --git a/src/Umbraco.Core/Persistence/IQueryRepository.cs b/src/Umbraco.Core/Persistence/IQueryRepository.cs
index 6623fbf0fc..1a8dbaf971 100644
--- a/src/Umbraco.Core/Persistence/IQueryRepository.cs
+++ b/src/Umbraco.Core/Persistence/IQueryRepository.cs
@@ -1,4 +1,4 @@
-using System.Collections.Generic;
+using System.Collections.Generic;
using Umbraco.Cms.Core.Persistence.Querying;
namespace Umbraco.Cms.Core.Persistence
@@ -11,7 +11,7 @@ namespace Umbraco.Cms.Core.Persistence
///
/// Gets entities.
///
- IEnumerable? Get(IQuery query);
+ IEnumerable Get(IQuery query);
///
/// Counts entities.
diff --git a/src/Umbraco.Core/Services/AuditService.cs b/src/Umbraco.Core/Services/AuditService.cs
index e9a35f80ba..f7560afa93 100644
--- a/src/Umbraco.Core/Services/AuditService.cs
+++ b/src/Umbraco.Core/Services/AuditService.cs
@@ -34,7 +34,7 @@ namespace Umbraco.Cms.Core.Services.Implement
}
}
- public IEnumerable? GetLogs(int objectId)
+ public IEnumerable GetLogs(int objectId)
{
using (var scope = ScopeProvider.CreateCoreScope())
{
diff --git a/src/Umbraco.Core/Services/ConsentService.cs b/src/Umbraco.Core/Services/ConsentService.cs
index 9a767d9c4e..d37e2e4d0f 100644
--- a/src/Umbraco.Core/Services/ConsentService.cs
+++ b/src/Umbraco.Core/Services/ConsentService.cs
@@ -57,7 +57,7 @@ namespace Umbraco.Cms.Core.Services
}
///
- public IEnumerable? LookupConsent(string? source = null, string? context = null, string? action = null,
+ public IEnumerable LookupConsent(string? source = null, string? context = null, string? action = null,
bool sourceStartsWith = false, bool contextStartsWith = false, bool actionStartsWith = false,
bool includeHistory = false)
{
diff --git a/src/Umbraco.Core/Services/ContentService.cs b/src/Umbraco.Core/Services/ContentService.cs
index e365020ab4..a2fa13a346 100644
--- a/src/Umbraco.Core/Services/ContentService.cs
+++ b/src/Umbraco.Core/Services/ContentService.cs
@@ -513,7 +513,7 @@ namespace Umbraco.Cms.Core.Services
///
///
///
- public IEnumerable? GetByIds(IEnumerable ids)
+ public IEnumerable GetByIds(IEnumerable ids)
{
Guid[] idsA = ids.ToArray();
if (idsA.Length == 0)
@@ -533,7 +533,7 @@ namespace Umbraco.Cms.Core.Services
return idsA.Select(x => index.TryGetValue(x, out IContent? c) ? c : null).WhereNotNull();
}
- return null;
+ return Enumerable.Empty();
}
}
@@ -600,7 +600,7 @@ namespace Umbraco.Cms.Core.Services
/// The level to retrieve Content from
/// An Enumerable list of objects
/// Contrary to most methods, this method filters out trashed content items.
- public IEnumerable? GetByLevel(int level)
+ public IEnumerable GetByLevel(int level)
{
using (ICoreScope scope = ScopeProvider.CreateCoreScope(autoComplete: true))
{
@@ -670,10 +670,15 @@ namespace Umbraco.Cms.Core.Services
///
/// Id of the to retrieve ancestors for
/// An Enumerable list of objects
- public IEnumerable? GetAncestors(int id)
+ public IEnumerable GetAncestors(int id)
{
// intentionally not locking
IContent? content = GetById(id);
+ if (content is null)
+ {
+ return Enumerable.Empty();
+ }
+
return GetAncestors(content);
}
@@ -682,10 +687,10 @@ namespace Umbraco.Cms.Core.Services
///
/// to retrieve ancestors for
/// An Enumerable list of objects
- public IEnumerable? GetAncestors(IContent? content)
+ public IEnumerable GetAncestors(IContent content)
{
//null check otherwise we get exceptions
- if (content?.Path.IsNullOrWhiteSpace() ?? true)
+ if (content.Path.IsNullOrWhiteSpace())
{
return Enumerable.Empty();
}
@@ -708,13 +713,13 @@ namespace Umbraco.Cms.Core.Services
///
/// Id of the Parent to retrieve Children from
/// An Enumerable list of published objects
- public IEnumerable? GetPublishedChildren(int id)
+ public IEnumerable GetPublishedChildren(int id)
{
using (ICoreScope scope = ScopeProvider.CreateCoreScope(autoComplete: true))
{
scope.ReadLock(Constants.Locks.ContentTree);
IQuery? query = Query().Where(x => x.ParentId == id && x.Published);
- return _documentRepository.Get(query)?.OrderBy(x => x.SortOrder);
+ return _documentRepository.Get(query).OrderBy(x => x.SortOrder);
}
}
@@ -849,7 +854,7 @@ namespace Umbraco.Cms.Core.Services
{
scope.ReadLock(Constants.Locks.ContentTree);
IQuery query = Query().Where(x => x.ParentId == Constants.System.Root);
- return _documentRepository.Get(query) ?? Enumerable.Empty();
+ return _documentRepository.Get(query);
}
}
@@ -857,7 +862,7 @@ namespace Umbraco.Cms.Core.Services
/// Gets all published content items
///
///
- internal IEnumerable? GetAllPublished()
+ internal IEnumerable GetAllPublished()
{
using (ICoreScope scope = ScopeProvider.CreateCoreScope(autoComplete: true))
{
@@ -2559,7 +2564,7 @@ namespace Umbraco.Cms.Core.Services
// emptying the recycle bin means deleting whatever is in there - do it properly!
IQuery? query = Query().Where(x => x.ParentId == Constants.System.RecycleBinContent);
- IContent[]? contents = _documentRepository.Get(query)?.ToArray();
+ IContent[] contents = _documentRepository.Get(query).ToArray();
var emptyingRecycleBinNotification = new ContentEmptyingRecycleBinNotification(contents, eventMessages);
if (scope.Notifications.PublishCancelable(emptyingRecycleBinNotification))
@@ -2982,7 +2987,7 @@ namespace Umbraco.Cms.Core.Services
var pathMatch = content.Path + ",";
IQuery query = Query()
.Where(x => x.Id != content.Id && x.Path.StartsWith(pathMatch) /*&& x.Trashed == false*/);
- IEnumerable? contents = _documentRepository.Get(query);
+ IEnumerable contents = _documentRepository.Get(query);
// beware! contents contains all published version below content
// including those that are not directly published because below an unpublished content
@@ -3355,7 +3360,7 @@ namespace Umbraco.Cms.Core.Services
scope.WriteLock(Constants.Locks.ContentTree);
IQuery query = Query().WhereIn(x => x.ContentTypeId, contentTypeIdsA);
- IContent[]? contents = _documentRepository.Get(query)?.ToArray();
+ IContent[] contents = _documentRepository.Get(query).ToArray();
if (contents is null)
{
@@ -3383,15 +3388,12 @@ namespace Umbraco.Cms.Core.Services
// if current content has children, move them to trash
IContent c = content;
IQuery childQuery = Query().Where(x => x.ParentId == c.Id);
- IEnumerable? children = _documentRepository.Get(childQuery);
- if (children is not null)
+ IEnumerable children = _documentRepository.Get(childQuery);
+ foreach (IContent child in children)
{
- foreach (IContent child in children)
- {
- // see MoveToRecycleBin
- PerformMoveLocked(child, Constants.System.RecycleBinContent, null, userId, moves, true);
- changes.Add(new TreeChange(content, TreeChangeTypes.RefreshBranch));
- }
+ // see MoveToRecycleBin
+ PerformMoveLocked(child, Constants.System.RecycleBinContent, null, userId, moves, true);
+ changes.Add(new TreeChange(content, TreeChangeTypes.RefreshBranch));
}
// delete content
@@ -3442,7 +3444,7 @@ namespace Umbraco.Cms.Core.Services
scope.ReadLock(Constants.Locks.ContentTypes);
IQuery query = Query().Where(x => x.Alias == contentTypeAlias);
- IContentType? contentType = _contentTypeRepository.Get(query)?.FirstOrDefault();
+ IContentType? contentType = _contentTypeRepository.Get(query).FirstOrDefault();
if (contentType == null)
{
@@ -3604,7 +3606,7 @@ namespace Umbraco.Cms.Core.Services
return content;
}
- public IEnumerable? GetBlueprintsForContentTypes(params int[] contentTypeId)
+ public IEnumerable GetBlueprintsForContentTypes(params int[] contentTypeId)
{
using (ScopeProvider.CreateCoreScope(autoComplete: true))
{
@@ -3614,7 +3616,7 @@ namespace Umbraco.Cms.Core.Services
query.Where(x => contentTypeId.Contains(x.ContentTypeId));
}
- return _documentBlueprintRepository.Get(query)?.Select(x =>
+ return _documentBlueprintRepository.Get(query).Select(x =>
{
x.Blueprint = true;
return x;
diff --git a/src/Umbraco.Core/Services/ContentTypeServiceBaseOfTRepositoryTItemTService.cs b/src/Umbraco.Core/Services/ContentTypeServiceBaseOfTRepositoryTItemTService.cs
index 7eb87b28a9..10775e2ce3 100644
--- a/src/Umbraco.Core/Services/ContentTypeServiceBaseOfTRepositoryTItemTService.cs
+++ b/src/Umbraco.Core/Services/ContentTypeServiceBaseOfTRepositoryTItemTService.cs
@@ -312,7 +312,7 @@ namespace Umbraco.Cms.Core.Services
}
}
- public IEnumerable? GetChildren(int id)
+ public IEnumerable GetChildren(int id)
{
using (var scope = ScopeProvider.CreateCoreScope(autoComplete: true))
{
@@ -322,7 +322,7 @@ namespace Umbraco.Cms.Core.Services
}
}
- public IEnumerable? GetChildren(Guid id)
+ public IEnumerable GetChildren(Guid id)
{
using (var scope = ScopeProvider.CreateCoreScope(autoComplete: true))
{
@@ -403,7 +403,7 @@ namespace Umbraco.Cms.Core.Services
{
var i = ids.Pop();
var query = Query().Where(x => x.ParentId == i);
- var result = Repository.Get(query)?.ToArray();
+ var result = Repository.Get(query).ToArray();
if (result is not null)
{
diff --git a/src/Umbraco.Core/Services/DataTypeService.cs b/src/Umbraco.Core/Services/DataTypeService.cs
index 007b8e8357..5c9d5847ed 100644
--- a/src/Umbraco.Core/Services/DataTypeService.cs
+++ b/src/Umbraco.Core/Services/DataTypeService.cs
@@ -164,7 +164,7 @@ namespace Umbraco.Cms.Core.Services.Implement
}
}
- public IEnumerable? GetContainers(IDataType dataType)
+ public IEnumerable GetContainers(IDataType dataType)
{
var ancestorIds = dataType.Path.Split(Constants.CharArrays.Comma, StringSplitOptions.RemoveEmptyEntries)
.Select(x =>
@@ -178,7 +178,7 @@ namespace Umbraco.Cms.Core.Services.Implement
return GetContainers(ancestorIds);
}
- public IEnumerable? GetContainers(int[] containerIds)
+ public IEnumerable GetContainers(int[] containerIds)
{
using (var scope = ScopeProvider.CreateCoreScope(autoComplete: true))
{
@@ -333,7 +333,7 @@ namespace Umbraco.Cms.Core.Services.Implement
using (var scope = ScopeProvider.CreateCoreScope(autoComplete: true))
{
var query = Query().Where(x => x.Key == id);
- var dataType = _dataTypeRepository.Get(query)?.FirstOrDefault();
+ var dataType = _dataTypeRepository.Get(query).FirstOrDefault();
ConvertMissingEditorOfDataTypeToLabel(dataType);
return dataType;
}
@@ -344,16 +344,12 @@ namespace Umbraco.Cms.Core.Services.Implement
///
/// Alias of the property editor
/// Collection of objects with a matching control id
- public IEnumerable? GetByEditorAlias(string propertyEditorAlias)
+ public IEnumerable GetByEditorAlias(string propertyEditorAlias)
{
using (var scope = ScopeProvider.CreateCoreScope(autoComplete: true))
{
var query = Query().Where(x => x.EditorAlias == propertyEditorAlias);
var dataType = _dataTypeRepository.Get(query);
- if (dataType is null)
- {
- return null;
- }
ConvertMissingEditorsOfDataTypesToLabels(dataType);
return dataType;
}
diff --git a/src/Umbraco.Core/Services/EntityXmlSerializer.cs b/src/Umbraco.Core/Services/EntityXmlSerializer.cs
index a5500ac690..8123dd06da 100644
--- a/src/Umbraco.Core/Services/EntityXmlSerializer.cs
+++ b/src/Umbraco.Core/Services/EntityXmlSerializer.cs
@@ -196,14 +196,11 @@ namespace Umbraco.Cms.Core.Services
if (dataType.Level != 1)
{
//get URL encoded folder names
- var folders = _dataTypeService.GetContainers(dataType)?
+ IOrderedEnumerable folders = _dataTypeService.GetContainers(dataType)
.OrderBy(x => x.Level);
- if (folders is not null)
- {
- folderNames = string.Join("/", folders.Select(x => WebUtility.UrlEncode(x.Name)).ToArray());
- folderKeys = string.Join("/", folders.Select(x => x.Key).ToArray());
- }
+ folderNames = string.Join("/", folders.Select(x => WebUtility.UrlEncode(x.Name)).ToArray());
+ folderKeys = string.Join("/", folders.Select(x => x.Key).ToArray());
}
if (string.IsNullOrWhiteSpace(folderNames) == false)
diff --git a/src/Umbraco.Core/Services/ExternalLoginService.cs b/src/Umbraco.Core/Services/ExternalLoginService.cs
index 4fde36ad37..d934e89528 100644
--- a/src/Umbraco.Core/Services/ExternalLoginService.cs
+++ b/src/Umbraco.Core/Services/ExternalLoginService.cs
@@ -33,12 +33,12 @@ namespace Umbraco.Cms.Core.Services
///
[Obsolete("Use overload that takes a user/member key (Guid).")]
- public IEnumerable? GetExternalLogins(int userId)
+ public IEnumerable GetExternalLogins(int userId)
=> GetExternalLogins(userId.ToGuid());
///
[Obsolete("Use overload that takes a user/member key (Guid).")]
- public IEnumerable? GetExternalLoginTokens(int userId) =>
+ public IEnumerable GetExternalLoginTokens(int userId) =>
GetExternalLoginTokens(userId.ToGuid());
///
@@ -57,32 +57,32 @@ namespace Umbraco.Cms.Core.Services
=> DeleteUserLogins(userId.ToGuid());
///
- public IEnumerable? GetExternalLogins(Guid userOrMemberKey)
+ public IEnumerable GetExternalLogins(Guid userOrMemberKey)
{
using (var scope = ScopeProvider.CreateCoreScope(autoComplete: true))
{
- return _externalLoginRepository.Get(Query().Where(x => x.Key == userOrMemberKey))?
+ return _externalLoginRepository.Get(Query().Where(x => x.Key == userOrMemberKey))
.ToList();
}
}
///
- public IEnumerable? GetExternalLoginTokens(Guid userOrMemberKey)
+ public IEnumerable GetExternalLoginTokens(Guid userOrMemberKey)
{
using (var scope = ScopeProvider.CreateCoreScope(autoComplete: true))
{
- return _externalLoginRepository.Get(Query().Where(x => x.Key == userOrMemberKey))?
+ return _externalLoginRepository.Get(Query().Where(x => x.Key == userOrMemberKey))
.ToList();
}
}
///
- public IEnumerable? Find(string loginProvider, string providerKey)
+ public IEnumerable Find(string loginProvider, string providerKey)
{
using (var scope = ScopeProvider.CreateCoreScope(autoComplete: true))
{
return _externalLoginRepository.Get(Query()
- .Where(x => x.ProviderKey == providerKey && x.LoginProvider == loginProvider))?
+ .Where(x => x.ProviderKey == providerKey && x.LoginProvider == loginProvider))
.ToList();
}
}
diff --git a/src/Umbraco.Core/Services/FileService.cs b/src/Umbraco.Core/Services/FileService.cs
index 27ec6660e5..2d901ffacd 100644
--- a/src/Umbraco.Core/Services/FileService.cs
+++ b/src/Umbraco.Core/Services/FileService.cs
@@ -153,7 +153,7 @@ namespace Umbraco.Cms.Core.Services
}
///
- public Stream? GetStylesheetFileContentStream(string filepath)
+ public Stream GetStylesheetFileContentStream(string filepath)
{
using (ICoreScope scope = ScopeProvider.CreateCoreScope(autoComplete: true))
{
@@ -283,7 +283,7 @@ namespace Umbraco.Cms.Core.Services
}
///
- public Stream? GetScriptFileContentStream(string filepath)
+ public Stream GetScriptFileContentStream(string filepath)
{
using (ICoreScope scope = ScopeProvider.CreateCoreScope(autoComplete: true))
{
@@ -597,11 +597,7 @@ namespace Umbraco.Cms.Core.Services
fileName = $"{fileName}.cshtml";
}
- Stream? fs = _templateRepository.GetFileContentStream(fileName);
- if (fs == null)
- {
- return null;
- }
+ Stream fs = _templateRepository.GetFileContentStream(fileName);
using (var view = new StreamReader(fs))
{
@@ -610,7 +606,7 @@ namespace Umbraco.Cms.Core.Services
}
///
- public Stream? GetTemplateFileContentStream(string filepath)
+ public Stream GetTemplateFileContentStream(string filepath)
{
using (ICoreScope scope = ScopeProvider.CreateCoreScope(autoComplete: true))
{
@@ -898,7 +894,7 @@ namespace Umbraco.Cms.Core.Services
}
///
- public Stream? GetPartialViewFileContentStream(string filepath)
+ public Stream GetPartialViewFileContentStream(string filepath)
{
using (ICoreScope scope = ScopeProvider.CreateCoreScope(autoComplete: true))
{
@@ -926,7 +922,7 @@ namespace Umbraco.Cms.Core.Services
}
///
- public Stream? GetPartialViewMacroFileContentStream(string filepath)
+ public Stream GetPartialViewMacroFileContentStream(string filepath)
{
using (ICoreScope scope = ScopeProvider.CreateCoreScope(autoComplete: true))
{
diff --git a/src/Umbraco.Core/Services/IAuditService.cs b/src/Umbraco.Core/Services/IAuditService.cs
index cbc3db8239..df816960a3 100644
--- a/src/Umbraco.Core/Services/IAuditService.cs
+++ b/src/Umbraco.Core/Services/IAuditService.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using System.Collections.Generic;
using Umbraco.Cms.Core.Models;
using Umbraco.Cms.Core.Persistence.Querying;
@@ -12,7 +12,7 @@ namespace Umbraco.Cms.Core.Services
{
void Add(AuditType type, int userId, int objectId, string? entityType, string comment, string? parameters = null);
- IEnumerable? GetLogs(int objectId);
+ IEnumerable GetLogs(int objectId);
IEnumerable GetUserLogs(int userId, AuditType type, DateTime? sinceDate = null);
IEnumerable GetLogs(AuditType type, DateTime? sinceDate = null);
void CleanLogs(int maximumAgeOfLogsInMinutes);
diff --git a/src/Umbraco.Core/Services/IConsentService.cs b/src/Umbraco.Core/Services/IConsentService.cs
index 50222a7f28..d191caebe2 100644
--- a/src/Umbraco.Core/Services/IConsentService.cs
+++ b/src/Umbraco.Core/Services/IConsentService.cs
@@ -1,4 +1,4 @@
-using System.Collections.Generic;
+using System.Collections.Generic;
using Umbraco.Cms.Core.Models;
namespace Umbraco.Cms.Core.Services
@@ -38,7 +38,7 @@ namespace Umbraco.Cms.Core.Services
/// Determines whether is a start pattern.
/// Determines whether to include the history of consents.
/// Consents matching the parameters.
- IEnumerable? LookupConsent(string? source = null, string? context = null, string? action = null,
+ IEnumerable LookupConsent(string? source = null, string? context = null, string? action = null,
bool sourceStartsWith = false, bool contextStartsWith = false, bool actionStartsWith = false,
bool includeHistory = false);
}
diff --git a/src/Umbraco.Core/Services/IContentService.cs b/src/Umbraco.Core/Services/IContentService.cs
index cfc582a5b2..93d51da757 100644
--- a/src/Umbraco.Core/Services/IContentService.cs
+++ b/src/Umbraco.Core/Services/IContentService.cs
@@ -26,7 +26,7 @@ namespace Umbraco.Cms.Core.Services
///
/// Gets blueprints for a content type.
///
- IEnumerable? GetBlueprintsForContentTypes(params int[] documentTypeId);
+ IEnumerable GetBlueprintsForContentTypes(params int[] documentTypeId);
///
/// Saves a blueprint.
@@ -89,12 +89,12 @@ namespace Umbraco.Cms.Core.Services
///
/// Gets documents.
///
- IEnumerable? GetByIds(IEnumerable ids);
+ IEnumerable GetByIds(IEnumerable ids);
///
/// Gets documents at a given level.
///
- IEnumerable? GetByLevel(int level);
+ IEnumerable GetByLevel(int level);
///
/// Gets the parent of a document.
@@ -109,12 +109,12 @@ namespace Umbraco.Cms.Core.Services
///
/// Gets ancestor documents of a document.
///
- IEnumerable? GetAncestors(int id);
+ IEnumerable GetAncestors(int id);
///
/// Gets ancestor documents of a document.
///
- IEnumerable? GetAncestors(IContent content);
+ IEnumerable GetAncestors(IContent content);
///
/// Gets all versions of a document.
diff --git a/src/Umbraco.Core/Services/IContentTypeServiceBase.cs b/src/Umbraco.Core/Services/IContentTypeServiceBase.cs
index 17923c61da..c0d5bb96a0 100644
--- a/src/Umbraco.Core/Services/IContentTypeServiceBase.cs
+++ b/src/Umbraco.Core/Services/IContentTypeServiceBase.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using System.Collections.Generic;
using Umbraco.Cms.Core.Models;
@@ -50,8 +50,8 @@ namespace Umbraco.Cms.Core.Services
IEnumerable GetDescendants(int id, bool andSelf); // parent-child axis
IEnumerable GetComposedOf(int id); // composition axis
- IEnumerable? GetChildren(int id);
- IEnumerable? GetChildren(Guid id);
+ IEnumerable GetChildren(int id);
+ IEnumerable GetChildren(Guid id);
bool HasChildren(int id);
bool HasChildren(Guid id);
diff --git a/src/Umbraco.Core/Services/IDataTypeService.cs b/src/Umbraco.Core/Services/IDataTypeService.cs
index 4a765ce384..898b24355e 100644
--- a/src/Umbraco.Core/Services/IDataTypeService.cs
+++ b/src/Umbraco.Core/Services/IDataTypeService.cs
@@ -22,8 +22,8 @@ namespace Umbraco.Cms.Core.Services
EntityContainer? GetContainer(int containerId);
EntityContainer? GetContainer(Guid containerId);
IEnumerable GetContainers(string folderName, int level);
- IEnumerable? GetContainers(IDataType dataType);
- IEnumerable? GetContainers(int[] containerIds);
+ IEnumerable GetContainers(IDataType dataType);
+ IEnumerable GetContainers(int[] containerIds);
Attempt DeleteContainer(int containerId, int userId = Constants.Security.SuperUserId);
Attempt?> RenameContainer(int id, string name, int userId = Constants.Security.SuperUserId);
@@ -85,7 +85,7 @@ namespace Umbraco.Cms.Core.Services
///
/// Alias of the property editor
/// Collection of objects with a matching control id
- IEnumerable? GetByEditorAlias(string propertyEditorAlias);
+ IEnumerable GetByEditorAlias(string propertyEditorAlias);
Attempt?> Move(IDataType toMove, int parentId);
}
diff --git a/src/Umbraco.Core/Services/IExternalLoginService.cs b/src/Umbraco.Core/Services/IExternalLoginService.cs
index 05f131919e..75f8069f0c 100644
--- a/src/Umbraco.Core/Services/IExternalLoginService.cs
+++ b/src/Umbraco.Core/Services/IExternalLoginService.cs
@@ -15,14 +15,14 @@ namespace Umbraco.Cms.Core.Services
///
///
///
- IEnumerable? GetExternalLogins(int userId);
+ IEnumerable GetExternalLogins(int userId);
///
/// Returns all user login tokens assigned
///
///
///
- IEnumerable? GetExternalLoginTokens(int userId);
+ IEnumerable GetExternalLoginTokens(int userId);
///
/// Returns all logins matching the login info - generally there should only be one but in some cases
@@ -31,7 +31,7 @@ namespace Umbraco.Cms.Core.Services
///
///
///
- IEnumerable? Find(string loginProvider, string providerKey);
+ IEnumerable Find(string loginProvider, string providerKey);
///
/// Saves the external logins associated with the user
diff --git a/src/Umbraco.Core/Services/IExternalLoginWithKeyService.cs b/src/Umbraco.Core/Services/IExternalLoginWithKeyService.cs
index 1b378491c0..bc31f54f8b 100644
--- a/src/Umbraco.Core/Services/IExternalLoginWithKeyService.cs
+++ b/src/Umbraco.Core/Services/IExternalLoginWithKeyService.cs
@@ -9,18 +9,18 @@ namespace Umbraco.Cms.Core.Services
///
/// Returns all user logins assigned
///
- IEnumerable? GetExternalLogins(Guid userOrMemberKey);
+ IEnumerable GetExternalLogins(Guid userOrMemberKey);
///
/// Returns all user login tokens assigned
///
- IEnumerable? GetExternalLoginTokens(Guid userOrMemberKey);
+ IEnumerable GetExternalLoginTokens(Guid userOrMemberKey);
///
/// Returns all logins matching the login info - generally there should only be one but in some cases
/// there might be more than one depending on if an administrator has been editing/removing members
///
- IEnumerable? Find(string loginProvider, string providerKey);
+ IEnumerable Find(string loginProvider, string providerKey);
///
/// Saves the external logins associated with the user
diff --git a/src/Umbraco.Core/Services/IFileService.cs b/src/Umbraco.Core/Services/IFileService.cs
index 03798c8597..8d68c20c81 100644
--- a/src/Umbraco.Core/Services/IFileService.cs
+++ b/src/Umbraco.Core/Services/IFileService.cs
@@ -36,7 +36,7 @@ namespace Umbraco.Cms.Core.Services
///
/// The filesystem path to the partial view.
/// The content of the partial view.
- Stream? GetPartialViewFileContentStream(string filepath);
+ Stream GetPartialViewFileContentStream(string filepath);
///
/// Sets the content of a partial view.
@@ -57,7 +57,7 @@ namespace Umbraco.Cms.Core.Services
///
/// The filesystem path to the macro partial view.
/// The content of the macro partial view.
- Stream? GetPartialViewMacroFileContentStream(string filepath);
+ Stream GetPartialViewMacroFileContentStream(string filepath);
///
/// Sets the content of a macro partial view.
@@ -118,7 +118,7 @@ namespace Umbraco.Cms.Core.Services
///
/// The filesystem path to the stylesheet.
/// The content of the stylesheet.
- Stream? GetStylesheetFileContentStream(string filepath);
+ Stream GetStylesheetFileContentStream(string filepath);
///
/// Sets the content of a stylesheet.
@@ -179,7 +179,7 @@ namespace Umbraco.Cms.Core.Services
///
/// The filesystem path to the script.
/// The content of the script file.
- Stream? GetScriptFileContentStream(string filepath);
+ Stream GetScriptFileContentStream(string filepath);
///
/// Sets the content of a script file.
@@ -274,7 +274,7 @@ namespace Umbraco.Cms.Core.Services
///
/// The filesystem path to the template.
/// The content of the template.
- Stream? GetTemplateFileContentStream(string filepath);
+ Stream GetTemplateFileContentStream(string filepath);
///
/// Sets the content of a template.
diff --git a/src/Umbraco.Core/Services/IMediaService.cs b/src/Umbraco.Core/Services/IMediaService.cs
index 1ec534029b..ee6ba02b66 100644
--- a/src/Umbraco.Core/Services/IMediaService.cs
+++ b/src/Umbraco.Core/Services/IMediaService.cs
@@ -338,7 +338,7 @@ namespace Umbraco.Cms.Core.Services
///
/// The filesystem path to the media.
/// The content of the media.
- Stream? GetMediaFileContentStream(string filepath);
+ Stream GetMediaFileContentStream(string filepath);
///
/// Sets the content of a media.
diff --git a/src/Umbraco.Infrastructure/Security/BackOfficeUserStore.cs b/src/Umbraco.Infrastructure/Security/BackOfficeUserStore.cs
index c32362d56c..c91dda8890 100644
--- a/src/Umbraco.Infrastructure/Security/BackOfficeUserStore.cs
+++ b/src/Umbraco.Infrastructure/Security/BackOfficeUserStore.cs
@@ -413,8 +413,8 @@ namespace Umbraco.Cms.Core.Security
cancellationToken.ThrowIfCancellationRequested();
ThrowIfDisposed();
- var logins = _externalLoginService.Find(loginProvider, providerKey)?.ToList();
- if (logins is null || logins.Count == 0)
+ var logins = _externalLoginService.Find(loginProvider, providerKey).ToList();
+ if (logins.Count == 0)
{
return Task.FromResult((IdentityUserLogin)null!);
}
diff --git a/src/Umbraco.Infrastructure/Security/MemberUserStore.cs b/src/Umbraco.Infrastructure/Security/MemberUserStore.cs
index 3d8f3447d5..87eb5f363e 100644
--- a/src/Umbraco.Infrastructure/Security/MemberUserStore.cs
+++ b/src/Umbraco.Infrastructure/Security/MemberUserStore.cs
@@ -440,8 +440,8 @@ namespace Umbraco.Cms.Core.Security
throw new ArgumentNullException(nameof(providerKey));
}
- var logins = _externalLoginService.Find(loginProvider, providerKey)?.ToList();
- if (logins is null || logins.Count == 0)
+ var logins = _externalLoginService.Find(loginProvider, providerKey).ToList();
+ if (logins.Count == 0)
{
return Task.FromResult((IdentityUserLogin)null!);
}