diff --git a/Directory.Packages.props b/Directory.Packages.props
index 5107faad00..e9c39aeae8 100644
--- a/Directory.Packages.props
+++ b/Directory.Packages.props
@@ -60,8 +60,8 @@
-
-
+
+
diff --git a/global.json b/global.json
index d5eb15969c..5f3c376000 100644
--- a/global.json
+++ b/global.json
@@ -1,6 +1,6 @@
{
"sdk": {
- "version": "10.0.100-preview.7.25380.108",
+ "version": "10.0.100-rc.1.25451.107",
"rollForward": "latestFeature",
"allowPrerelease": false
}
diff --git a/src/Umbraco.Cms.Api.Delivery/Routing/DeliveryApiItemsEndpointsMatcherPolicy.cs b/src/Umbraco.Cms.Api.Delivery/Routing/DeliveryApiItemsEndpointsMatcherPolicy.cs
index 186cd4f555..89289104e1 100644
--- a/src/Umbraco.Cms.Api.Delivery/Routing/DeliveryApiItemsEndpointsMatcherPolicy.cs
+++ b/src/Umbraco.Cms.Api.Delivery/Routing/DeliveryApiItemsEndpointsMatcherPolicy.cs
@@ -66,9 +66,14 @@ internal sealed class DeliveryApiItemsEndpointsMatcherPolicy : MatcherPolicy, IE
{
ApiVersion[]? supportedApiVersions = endpoint.Metadata.GetMetadata()?.Versions.ToArray();
- // if the endpoint is versioned, the requested API version must be among the API versions supported by the endpoint.
- // if the endpoint is NOT versioned, it cannot be used with a requested API version
- return supportedApiVersions?.Contains(requestedApiVersion) ?? requestedApiVersion is null;
+ // If the endpoint is versioned, the requested API version must be among the API versions supported by the endpoint.
+ // If the endpoint is NOT versioned, it cannot be used with a requested API version.
+ if (supportedApiVersions is not null && requestedApiVersion is not null)
+ {
+ return supportedApiVersions.Contains(requestedApiVersion);
+ }
+
+ return requestedApiVersion is null;
}
private static bool IsByIdsController(ControllerActionDescriptor? controllerActionDescriptor)
diff --git a/src/Umbraco.Cms.Api.Management/Services/Entities/UserStartNodeEntitiesService.cs b/src/Umbraco.Cms.Api.Management/Services/Entities/UserStartNodeEntitiesService.cs
index 6fda490b61..96b547ec31 100644
--- a/src/Umbraco.Cms.Api.Management/Services/Entities/UserStartNodeEntitiesService.cs
+++ b/src/Umbraco.Cms.Api.Management/Services/Entities/UserStartNodeEntitiesService.cs
@@ -87,10 +87,12 @@ public class UserStartNodeEntitiesService : IUserStartNodeEntitiesService
return ChildUserAccessEntities(children, userStartNodePaths);
}
- int[] allowedChildIds = GetAllowedIds(userStartNodePaths, parentId);
+ // Need to use a List here because the expression tree cannot convert an array when used in Contains.
+ // See ExpressionTests.Sql_In().
+ List allowedChildIds = GetAllowedIds(userStartNodePaths, parentId);
- totalItems = allowedChildIds.Length;
- if (allowedChildIds.Length == 0)
+ totalItems = allowedChildIds.Count;
+ if (allowedChildIds.Count == 0)
{
// The requested parent is outside the scope of any user start nodes.
return [];
@@ -102,7 +104,7 @@ public class UserStartNodeEntitiesService : IUserStartNodeEntitiesService
return ChildUserAccessEntities(children, userStartNodePaths);
}
- private static int[] GetAllowedIds(string[] userStartNodePaths, int parentId)
+ private static List GetAllowedIds(string[] userStartNodePaths, int parentId)
{
// If one or more of the user start nodes are descendants of the requested parent, find the "next child IDs" in those user start node paths
// that are the final entries in the path.
@@ -112,7 +114,7 @@ public class UserStartNodeEntitiesService : IUserStartNodeEntitiesService
.Where(ids => ids.Contains(parentId))
.Select(ids => ids[ids.IndexOf(parentId) + 1]) // Given the previous checks, the parent ID can never be the last in the user start node path, so this is safe
.Distinct()
- .ToArray();
+ .ToList();
}
///
@@ -185,9 +187,9 @@ public class UserStartNodeEntitiesService : IUserStartNodeEntitiesService
return ChildUserAccessEntities(siblings, userStartNodePaths);
}
- int[] allowedSiblingIds = GetAllowedIds(userStartNodePaths, targetParent.Id);
+ List allowedSiblingIds = GetAllowedIds(userStartNodePaths, targetParent.Id);
- if (allowedSiblingIds.Length == 0)
+ if (allowedSiblingIds.Count == 0)
{
// The requested target is outside the scope of any user start nodes.
totalBefore = 0;
diff --git a/src/Umbraco.Cms.Persistence.SqlServer/Services/SqlServerDistributedLockingMechanism.cs b/src/Umbraco.Cms.Persistence.SqlServer/Services/SqlServerDistributedLockingMechanism.cs
index d0ffd7ee4f..fb0cb9133e 100644
--- a/src/Umbraco.Cms.Persistence.SqlServer/Services/SqlServerDistributedLockingMechanism.cs
+++ b/src/Umbraco.Cms.Persistence.SqlServer/Services/SqlServerDistributedLockingMechanism.cs
@@ -132,7 +132,7 @@ public class SqlServerDistributedLockingMechanism : IDistributedLockingMechanism
throw new PanicException("Could not find a database");
}
- if (!db.InTransaction)
+ if (db.InTransaction is false || db.Transaction is null)
{
throw new InvalidOperationException(
"SqlServerDistributedLockingMechanism requires a transaction to function.");
@@ -167,7 +167,7 @@ public class SqlServerDistributedLockingMechanism : IDistributedLockingMechanism
throw new PanicException("Could not find a database");
}
- if (!db.InTransaction)
+ if (db.InTransaction is false || db.Transaction is null)
{
throw new InvalidOperationException(
"SqlServerDistributedLockingMechanism requires a transaction to function.");
diff --git a/src/Umbraco.Cms.Persistence.SqlServer/Services/SqlServerSyntaxProvider.cs b/src/Umbraco.Cms.Persistence.SqlServer/Services/SqlServerSyntaxProvider.cs
index 28ff4806a4..1464b049da 100644
--- a/src/Umbraco.Cms.Persistence.SqlServer/Services/SqlServerSyntaxProvider.cs
+++ b/src/Umbraco.Cms.Persistence.SqlServer/Services/SqlServerSyntaxProvider.cs
@@ -262,6 +262,12 @@ order by T.name, I.name");
///
public override bool TryGetDefaultConstraint(IDatabase db, string? tableName, string columnName, [MaybeNullWhen(false)] out string constraintName)
{
+ if (string.IsNullOrWhiteSpace(tableName))
+ {
+ constraintName = null;
+ return false;
+ }
+
constraintName = db.Fetch(
@"select con.[name] as [constraintName]
from sys.default_constraints con
diff --git a/src/Umbraco.Core/Models/Notification.cs b/src/Umbraco.Core/Models/Notification.cs
index 31d17513a6..e93a3bdeb6 100644
--- a/src/Umbraco.Core/Models/Notification.cs
+++ b/src/Umbraco.Core/Models/Notification.cs
@@ -2,7 +2,7 @@ namespace Umbraco.Cms.Core.Models;
public class Notification
{
- public Notification(int entityId, int userId, string action, Guid? entityType)
+ public Notification(int entityId, int userId, string action, Guid entityType)
{
EntityId = entityId;
UserId = userId;
@@ -16,5 +16,5 @@ public class Notification
public string Action { get; }
- public Guid? EntityType { get; }
+ public Guid EntityType { get; }
}
diff --git a/src/Umbraco.Core/Persistence/Repositories/INotificationsRepository.cs b/src/Umbraco.Core/Persistence/Repositories/INotificationsRepository.cs
index 5a3f63f8cb..0c36e233e1 100644
--- a/src/Umbraco.Core/Persistence/Repositories/INotificationsRepository.cs
+++ b/src/Umbraco.Core/Persistence/Repositories/INotificationsRepository.cs
@@ -1,3 +1,4 @@
+using System.Diagnostics.CodeAnalysis;
using Umbraco.Cms.Core.Models;
using Umbraco.Cms.Core.Models.Entities;
using Umbraco.Cms.Core.Models.Membership;
@@ -6,7 +7,7 @@ namespace Umbraco.Cms.Core.Persistence.Repositories;
public interface INotificationsRepository : IRepository
{
- Notification CreateNotification(IUser user, IEntity entity, string action);
+ bool TryCreateNotification(IUser user, IEntity entity, string action, [NotNullWhen(true)] out Notification? notification);
int DeleteNotifications(IUser user);
@@ -14,11 +15,11 @@ public interface INotificationsRepository : IRepository
int DeleteNotifications(IUser user, IEntity entity);
- IEnumerable? GetEntityNotifications(IEntity entity);
+ IEnumerable GetEntityNotifications(IEntity entity);
- IEnumerable? GetUserNotifications(IUser user);
+ IEnumerable GetUserNotifications(IUser user);
- IEnumerable? GetUsersNotifications(IEnumerable userIds, string? action, IEnumerable nodeIds, Guid objectType);
+ IEnumerable GetUsersNotifications(IEnumerable userIds, string? action, IEnumerable nodeIds, Guid objectType);
IEnumerable SetNotifications(IUser user, IEntity entity, string[] actions);
}
diff --git a/src/Umbraco.Core/Services/ContentService.cs b/src/Umbraco.Core/Services/ContentService.cs
index 139b057ba0..884eac7dd7 100644
--- a/src/Umbraco.Core/Services/ContentService.cs
+++ b/src/Umbraco.Core/Services/ContentService.cs
@@ -695,9 +695,13 @@ public class ContentService : RepositoryService, IContentService
using (ICoreScope scope = ScopeProvider.CreateCoreScope(autoComplete: true))
{
+ // Need to use a List here because the expression tree cannot convert the array when used in Contains.
+ // See ExpressionTests.Sql_In().
+ List contentTypeIdsAsList = [.. contentTypeIds];
+
scope.ReadLock(Constants.Locks.ContentTree);
return _documentRepository.GetPage(
- Query()?.Where(x => contentTypeIds.Contains(x.ContentTypeId)),
+ Query()?.Where(x => contentTypeIdsAsList.Contains(x.ContentTypeId)),
pageIndex,
pageSize,
out totalRecords,
@@ -3759,7 +3763,10 @@ public class ContentService : RepositoryService, IContentService
IQuery query = Query();
if (contentTypeId.Length > 0)
{
- query.Where(x => contentTypeId.Contains(x.ContentTypeId));
+ // Need to use a List here because the expression tree cannot convert the array when used in Contains.
+ // See ExpressionTests.Sql_In().
+ List contentTypeIdsAsList = [.. contentTypeId];
+ query.Where(x => contentTypeIdsAsList.Contains(x.ContentTypeId));
}
return _documentBlueprintRepository.Get(query).Select(x =>
@@ -3778,11 +3785,14 @@ public class ContentService : RepositoryService, IContentService
{
scope.WriteLock(Constants.Locks.ContentTree);
- var contentTypeIdsA = contentTypeIds.ToArray();
+ // Need to use a List here because the expression tree cannot convert an array when used in Contains.
+ // See ExpressionTests.Sql_In().
+ var contentTypeIdsAsList = contentTypeIds.ToList();
+
IQuery query = Query();
- if (contentTypeIdsA.Length > 0)
+ if (contentTypeIdsAsList.Count > 0)
{
- query.Where(x => contentTypeIdsA.Contains(x.ContentTypeId));
+ query.Where(x => contentTypeIdsAsList.Contains(x.ContentTypeId));
}
IContent[]? blueprints = _documentBlueprintRepository.Get(query)?.Select(x =>
diff --git a/src/Umbraco.Core/Services/DataTypeService.cs b/src/Umbraco.Core/Services/DataTypeService.cs
index 315cd430ef..04c8a91060 100644
--- a/src/Umbraco.Core/Services/DataTypeService.cs
+++ b/src/Umbraco.Core/Services/DataTypeService.cs
@@ -315,7 +315,10 @@ namespace Umbraco.Cms.Core.Services.Implement
IQuery query = Query();
if (keys.Length > 0)
{
- query = query.Where(x => keys.Contains(x.Key));
+ // Need to use a List here because the expression tree cannot convert the array when used in Contains.
+ // See ExpressionTests.Sql_In().
+ List keysAsList = [.. keys];
+ query = query.Where(x => keysAsList.Contains(x.Key));
}
IDataType[] dataTypes = _dataTypeRepository.Get(query).ToArray();
@@ -398,7 +401,12 @@ namespace Umbraco.Cms.Core.Services.Implement
public Task> GetByEditorAliasAsync(string[] propertyEditorAlias)
{
using ICoreScope scope = ScopeProvider.CreateCoreScope(autoComplete: true);
- IQuery query = Query().Where(x => propertyEditorAlias.Contains(x.EditorAlias));
+
+ // Need to use a List here because the expression tree cannot convert the array when used in Contains.
+ // See ExpressionTests.Sql_In().
+ List propertyEditorAliasesAsList = [.. propertyEditorAlias];
+ IQuery query = Query().Where(x => propertyEditorAliasesAsList.Contains(x.EditorAlias));
+
IEnumerable dataTypes = _dataTypeRepository.Get(query).ToArray();
return Task.FromResult(dataTypes);
}
diff --git a/src/Umbraco.Core/Services/INotificationService.cs b/src/Umbraco.Core/Services/INotificationService.cs
index 8472333d19..06193b2708 100644
--- a/src/Umbraco.Core/Services/INotificationService.cs
+++ b/src/Umbraco.Core/Services/INotificationService.cs
@@ -1,3 +1,4 @@
+using System.Diagnostics.CodeAnalysis;
using Umbraco.Cms.Core.Models;
using Umbraco.Cms.Core.Models.Entities;
using Umbraco.Cms.Core.Models.Membership;
@@ -82,11 +83,12 @@ public interface INotificationService : IService
IEnumerable? SetNotifications(IUser? user, IEntity entity, string[] actions);
///
- /// Creates a new notification
+ /// Tries to create a new notification.
///
- ///
- ///
+ /// The user.
+ /// The entity.
/// The action letter - note: this is a string for future compatibility
- ///
- Notification CreateNotification(IUser user, IEntity entity, string action);
+ /// The created notification.
+ ///
+ bool TryCreateNotification(IUser user, IEntity entity, string action, [NotNullWhen(true)] out Notification? notification);
}
diff --git a/src/Umbraco.Core/Services/MediaService.cs b/src/Umbraco.Core/Services/MediaService.cs
index a782ef0db9..df60ceee6e 100644
--- a/src/Umbraco.Core/Services/MediaService.cs
+++ b/src/Umbraco.Core/Services/MediaService.cs
@@ -498,10 +498,15 @@ namespace Umbraco.Cms.Core.Services
ordering = Ordering.By("sortOrder");
}
+ // Need to use a List here because the expression tree cannot convert the array when used in Contains.
+ // See ExpressionTests.Sql_In().
+ List contentTypeIdsAsList = [.. contentTypeIds];
+
using ICoreScope scope = ScopeProvider.CreateCoreScope(autoComplete: true);
scope.ReadLock(Constants.Locks.MediaTree);
+
return _mediaRepository.GetPage(
- Query()?.Where(x => contentTypeIds.Contains(x.ContentTypeId)), pageIndex, pageSize, out totalRecords, filter, ordering);
+ Query()?.Where(x => contentTypeIdsAsList.Contains(x.ContentTypeId)), pageIndex, pageSize, out totalRecords, filter, ordering);
}
///
diff --git a/src/Umbraco.Core/Services/NotificationService.cs b/src/Umbraco.Core/Services/NotificationService.cs
index 3d5673fd7a..d12ef6c6df 100644
--- a/src/Umbraco.Core/Services/NotificationService.cs
+++ b/src/Umbraco.Core/Services/NotificationService.cs
@@ -1,4 +1,5 @@
using System.Collections.Concurrent;
+using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using System.Text;
using Microsoft.Extensions.Logging;
@@ -241,20 +242,14 @@ public class NotificationService : INotificationService
}
}
- ///
- /// Creates a new notification
- ///
- ///
- ///
- /// The action letter - note: this is a string for future compatibility
- ///
- public Notification CreateNotification(IUser user, IEntity entity, string action)
+ ///
+ public bool TryCreateNotification(IUser user, IEntity entity, string action, [NotNullWhen(true)] out Notification? notification)
{
using (ICoreScope scope = _uowProvider.CreateCoreScope())
{
- Notification notification = _notificationsRepository.CreateNotification(user, entity, action);
+ var result = _notificationsRepository.TryCreateNotification(user, entity, action, out notification);
scope.Complete();
- return notification;
+ return result;
}
}
diff --git a/src/Umbraco.Core/Services/TemplateService.cs b/src/Umbraco.Core/Services/TemplateService.cs
index cfb70aefe5..169c81df75 100644
--- a/src/Umbraco.Core/Services/TemplateService.cs
+++ b/src/Umbraco.Core/Services/TemplateService.cs
@@ -182,7 +182,8 @@ public class TemplateService : RepositoryService, ITemplateService
IQuery query = Query();
if (keys.Any())
{
- query = query.Where(x => keys.Contains(x.Key));
+ var keysList = keys.ToList();
+ query = query.Where(x => keysList.Contains(x.Key));
}
IEnumerable templates = _templateRepository.Get(query).OrderBy(x => x.Name);
diff --git a/src/Umbraco.Infrastructure/Migrations/AsyncMigrationBase.cs b/src/Umbraco.Infrastructure/Migrations/AsyncMigrationBase.cs
index 461a79a0b4..859bee5f18 100644
--- a/src/Umbraco.Infrastructure/Migrations/AsyncMigrationBase.cs
+++ b/src/Umbraco.Infrastructure/Migrations/AsyncMigrationBase.cs
@@ -53,7 +53,7 @@ public abstract partial class AsyncMigrationBase : IDiscoverable
///
/// Gets the database type.
///
- protected DatabaseType DatabaseType => Context.Database.DatabaseType;
+ protected DatabaseType DatabaseType => (DatabaseType)Context.Database.DatabaseType;
///
/// Builds a Create expression.
diff --git a/src/Umbraco.Infrastructure/Migrations/Expressions/Alter/Table/AlterTableBuilder.cs b/src/Umbraco.Infrastructure/Migrations/Expressions/Alter/Table/AlterTableBuilder.cs
index b4f7b12563..de6c64268c 100644
--- a/src/Umbraco.Infrastructure/Migrations/Expressions/Alter/Table/AlterTableBuilder.cs
+++ b/src/Umbraco.Infrastructure/Migrations/Expressions/Alter/Table/AlterTableBuilder.cs
@@ -28,6 +28,7 @@ public class AlterTableBuilder : ExpressionBuilderBase? sql = _scopeAccessor.AmbientScope?.Database.SqlContext.Sql()
+ NPoco.Sql sql = ambientScope.Database.SqlContext.Sql()
.SelectCount()
.From()
.Where(x => x.Id == Constants.Security.SuperUserId && x.Password == "default");
- var result = _scopeAccessor.AmbientScope?.Database.ExecuteScalar(sql);
+ var result = _scopeAccessor.AmbientScope.Database.ExecuteScalar(sql);
var has = result != 1;
if (has == false)
{
// found only 1 user == the default user with default password
// however this always exists on uCloud, also need to check if there are other users too
- result = _scopeAccessor.AmbientScope?.Database.ExecuteScalar("SELECT COUNT(*) FROM umbracoUser");
+ result = _scopeAccessor.AmbientScope.Database.ExecuteScalar("SELECT COUNT(*) FROM umbracoUser");
has = result != 1;
}
scope.Complete();
diff --git a/src/Umbraco.Infrastructure/Migrations/MigrationExpressionBase.cs b/src/Umbraco.Infrastructure/Migrations/MigrationExpressionBase.cs
index 117eb8fe7b..187db2d7a2 100644
--- a/src/Umbraco.Infrastructure/Migrations/MigrationExpressionBase.cs
+++ b/src/Umbraco.Infrastructure/Migrations/MigrationExpressionBase.cs
@@ -20,7 +20,7 @@ public abstract class MigrationExpressionBase : IMigrationExpression
protected MigrationExpressionBase(IMigrationContext context) =>
Context = context ?? throw new ArgumentNullException(nameof(context));
- public DatabaseType DatabaseType => Context.Database.DatabaseType;
+ public IDatabaseType DatabaseType => Context.Database.DatabaseType;
protected IMigrationContext Context { get; }
diff --git a/src/Umbraco.Infrastructure/Persistence/Dtos/DictionaryDto.cs b/src/Umbraco.Infrastructure/Persistence/Dtos/DictionaryDto.cs
index 8d93616ac8..ed47cd7864 100644
--- a/src/Umbraco.Infrastructure/Persistence/Dtos/DictionaryDto.cs
+++ b/src/Umbraco.Infrastructure/Persistence/Dtos/DictionaryDto.cs
@@ -32,5 +32,5 @@ public class DictionaryDto // public as required to be accessible from Deploy fo
[ResultColumn]
[Reference(ReferenceType.Many, ColumnName = "UniqueId", ReferenceMemberName = "UniqueId")]
- public List? LanguageTextDtos { get; set; }
+ public List LanguageTextDtos { get; set; } = [];
}
diff --git a/src/Umbraco.Infrastructure/Persistence/Dtos/PropertyTypeGroupDto.cs b/src/Umbraco.Infrastructure/Persistence/Dtos/PropertyTypeGroupDto.cs
index 6e3bd0b70c..b9fcadd073 100644
--- a/src/Umbraco.Infrastructure/Persistence/Dtos/PropertyTypeGroupDto.cs
+++ b/src/Umbraco.Infrastructure/Persistence/Dtos/PropertyTypeGroupDto.cs
@@ -41,5 +41,5 @@ internal sealed class PropertyTypeGroupDto
[ResultColumn]
[Reference(ReferenceType.Many, ReferenceMemberName = "PropertyTypeGroupId")]
- public List? PropertyTypeDtos { get; set; }
+ public List PropertyTypeDtos { get; set; } = [];
}
diff --git a/src/Umbraco.Infrastructure/Persistence/Factories/PropertyGroupFactory.cs b/src/Umbraco.Infrastructure/Persistence/Factories/PropertyGroupFactory.cs
index f0ff524666..f85178cbac 100644
--- a/src/Umbraco.Infrastructure/Persistence/Factories/PropertyGroupFactory.cs
+++ b/src/Umbraco.Infrastructure/Persistence/Factories/PropertyGroupFactory.cs
@@ -25,7 +25,8 @@ internal static class PropertyGroupFactory
}
dto.PropertyTypeDtos = propertyGroup.PropertyTypes
- ?.Select(propertyType => BuildPropertyTypeDto(propertyGroup.Id, propertyType, contentTypeId)).ToList();
+ ?.Select(propertyType => BuildPropertyTypeDto(propertyGroup.Id, propertyType, contentTypeId)).ToList()
+ ?? [];
return dto;
}
diff --git a/src/Umbraco.Infrastructure/Persistence/ISqlContext.cs b/src/Umbraco.Infrastructure/Persistence/ISqlContext.cs
index 87bc1dd81f..31088e7b52 100644
--- a/src/Umbraco.Infrastructure/Persistence/ISqlContext.cs
+++ b/src/Umbraco.Infrastructure/Persistence/ISqlContext.cs
@@ -2,6 +2,7 @@ using NPoco;
using Umbraco.Cms.Core.Persistence.Querying;
using Umbraco.Cms.Infrastructure.Persistence.Mappers;
using Umbraco.Cms.Infrastructure.Persistence.SqlSyntax;
+using IMapperCollection = Umbraco.Cms.Infrastructure.Persistence.Mappers.IMapperCollection;
namespace Umbraco.Cms.Infrastructure.Persistence;
diff --git a/src/Umbraco.Infrastructure/Persistence/NPocoDatabaseExtensions.cs b/src/Umbraco.Infrastructure/Persistence/NPocoDatabaseExtensions.cs
index bebf59cbe7..b36bb2ca02 100644
--- a/src/Umbraco.Infrastructure/Persistence/NPocoDatabaseExtensions.cs
+++ b/src/Umbraco.Infrastructure/Persistence/NPocoDatabaseExtensions.cs
@@ -241,7 +241,7 @@ public static partial class NPocoDatabaseExtensions
///
///
///
- public static TConnection GetTypedConnection(IDbConnection connection)
+ public static TConnection GetTypedConnection(IDbConnection? connection)
where TConnection : class, IDbConnection
{
IDbConnection? c = connection;
@@ -258,7 +258,7 @@ public static partial class NPocoDatabaseExtensions
c = profiled.WrappedConnection;
break;
default:
- throw new NotSupportedException(connection.GetType().FullName);
+ throw new NotSupportedException(connection?.GetType().FullName);
}
}
}
diff --git a/src/Umbraco.Infrastructure/Persistence/NPocoDatabaseTypeExtensions.cs b/src/Umbraco.Infrastructure/Persistence/NPocoDatabaseTypeExtensions.cs
index 4dd63c9919..611fbfe52d 100644
--- a/src/Umbraco.Infrastructure/Persistence/NPocoDatabaseTypeExtensions.cs
+++ b/src/Umbraco.Infrastructure/Persistence/NPocoDatabaseTypeExtensions.cs
@@ -6,10 +6,10 @@ namespace Umbraco.Cms.Infrastructure.Persistence;
internal static class NPocoDatabaseTypeExtensions
{
[Obsolete("Usage of this method indicates a code smell.")]
- public static bool IsSqlServer(this DatabaseType databaseType)
+ public static bool IsSqlServer(this IDatabaseType databaseType)
=> databaseType is not null && databaseType.GetProviderName() == "Microsoft.Data.SqlClient";
[Obsolete("Usage of this method indicates a code smell.")]
- public static bool IsSqlite(this DatabaseType databaseType)
+ public static bool IsSqlite(this IDatabaseType databaseType)
=> databaseType is SQLiteDatabaseType;
}
diff --git a/src/Umbraco.Infrastructure/Persistence/Querying/ExpressionVisitorBase.cs b/src/Umbraco.Infrastructure/Persistence/Querying/ExpressionVisitorBase.cs
index a585151929..47a64c96e3 100644
--- a/src/Umbraco.Infrastructure/Persistence/Querying/ExpressionVisitorBase.cs
+++ b/src/Umbraco.Infrastructure/Persistence/Querying/ExpressionVisitorBase.cs
@@ -21,7 +21,7 @@ internal abstract class ExpressionVisitorBase
///
/// Gets the list of SQL parameters.
///
- protected readonly List