diff --git a/backend/src/Migrations/Migrations/ConvertEventStore.cs b/backend/src/Migrations/Migrations/ConvertEventStore.cs index c595be1e7..144e184df 100644 --- a/backend/src/Migrations/Migrations/ConvertEventStore.cs +++ b/backend/src/Migrations/Migrations/ConvertEventStore.cs @@ -48,7 +48,7 @@ public sealed class ConvertEventStore : MongoBase, IMigration await collection.Find(FindAll).ForEachAsync(async commit => { - foreach (BsonDocument @event in commit["Events"].AsBsonArray) + foreach (BsonDocument @event in commit["Events"].AsBsonArray.OfType()) { var meta = BsonDocument.Parse(@event["Metadata"].AsString); diff --git a/backend/src/Migrations/Migrations/ConvertEventStoreAppId.cs b/backend/src/Migrations/Migrations/ConvertEventStoreAppId.cs index 7c5f88765..f0ef17e7b 100644 --- a/backend/src/Migrations/Migrations/ConvertEventStoreAppId.cs +++ b/backend/src/Migrations/Migrations/ConvertEventStoreAppId.cs @@ -53,7 +53,7 @@ public sealed class ConvertEventStoreAppId : MongoBase, IMigration var index = 0; - foreach (BsonDocument @event in commit["Events"].AsBsonArray) + foreach (BsonDocument @event in commit["Events"].AsBsonArray.OfType()) { var data = BsonDocument.Parse(@event["Payload"].AsString); diff --git a/backend/src/Squidex.Domain.Apps.Core.Operations/ExtractReferenceIds/StringReferenceExtractor.cs b/backend/src/Squidex.Domain.Apps.Core.Operations/ExtractReferenceIds/StringReferenceExtractor.cs index 7449db7ae..9374c4698 100644 --- a/backend/src/Squidex.Domain.Apps.Core.Operations/ExtractReferenceIds/StringReferenceExtractor.cs +++ b/backend/src/Squidex.Domain.Apps.Core.Operations/ExtractReferenceIds/StringReferenceExtractor.cs @@ -80,7 +80,7 @@ public sealed class StringReferenceExtractor foreach (var pattern in contentsPatterns) { - foreach (Match match in pattern.Matches(text)) + foreach (Match match in pattern.Matches(text).OfType()) { yield return DomainId.Create(match.Groups["Id"].Value); } @@ -96,7 +96,7 @@ public sealed class StringReferenceExtractor foreach (var pattern in assetsPatterns) { - foreach (Match match in pattern.Matches(text)) + foreach (Match match in pattern.Matches(text).OfType()) { yield return DomainId.Create(match.Groups["Id"].Value); } diff --git a/backend/src/Squidex.Domain.Apps.Core.Operations/HandleRules/RuleContext.cs b/backend/src/Squidex.Domain.Apps.Core.Operations/HandleRules/RuleContext.cs index 6afb52d96..d73ae39c8 100644 --- a/backend/src/Squidex.Domain.Apps.Core.Operations/HandleRules/RuleContext.cs +++ b/backend/src/Squidex.Domain.Apps.Core.Operations/HandleRules/RuleContext.cs @@ -10,7 +10,7 @@ using Squidex.Infrastructure; namespace Squidex.Domain.Apps.Core.HandleRules; -public struct RuleContext +public readonly struct RuleContext { public NamedId AppId { get; init; } diff --git a/backend/src/Squidex.Domain.Apps.Entities/Apps/Templates/TemplatesClient.cs b/backend/src/Squidex.Domain.Apps.Entities/Apps/Templates/TemplatesClient.cs index 6becd489b..7717037bc 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Apps/Templates/TemplatesClient.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Apps/Templates/TemplatesClient.cs @@ -37,7 +37,7 @@ public sealed class TemplatesClient var text = await httpClient.GetStringAsync(url, ct); - foreach (Match match in Regex.Matches(text)) + foreach (Match match in Regex.Matches(text).OfType()) { var currentName = match.Groups["Name"].Value; @@ -65,7 +65,7 @@ public sealed class TemplatesClient var text = await httpClient.GetStringAsync(url, ct); - foreach (Match match in Regex.Matches(text)) + foreach (Match match in Regex.Matches(text).OfType()) { var title = match.Groups["Title"].Value; diff --git a/backend/src/Squidex.Infrastructure/Queries/PropertyPath.cs b/backend/src/Squidex.Infrastructure/Queries/PropertyPath.cs index 4aae953e7..f44bd7ee8 100644 --- a/backend/src/Squidex.Infrastructure/Queries/PropertyPath.cs +++ b/backend/src/Squidex.Infrastructure/Queries/PropertyPath.cs @@ -88,13 +88,6 @@ public sealed class PropertyPath : ReadonlyList return string.Join(".", this); } - private static string Unescape(string source) - { - return source - .Replace("\\/", "/", StringComparison.OrdinalIgnoreCase) - .Replace("\\.", ".", StringComparison.OrdinalIgnoreCase); - } - private static PropertyPath Create(IEnumerable? source) { var inner = source?.ToList(); diff --git a/backend/src/Squidex.Shared/Texts.cs b/backend/src/Squidex.Shared/Texts.cs index e6f368c66..06d13d5ab 100644 --- a/backend/src/Squidex.Shared/Texts.cs +++ b/backend/src/Squidex.Shared/Texts.cs @@ -15,15 +15,7 @@ namespace Squidex.Shared public static ResourceManager ResourceManager { - get - { - if (resourceManager == null) - { - resourceManager = new ResourceManager("Squidex.Shared.Texts", typeof(Texts).Assembly); - } - - return resourceManager; - } + get => resourceManager ??= new ResourceManager("Squidex.Shared.Texts", typeof(Texts).Assembly); } } } diff --git a/backend/src/Squidex/Areas/Api/Controllers/Backups/RestoreController.cs b/backend/src/Squidex/Areas/Api/Controllers/Backups/RestoreController.cs index af3c96068..aed62a568 100644 --- a/backend/src/Squidex/Areas/Api/Controllers/Backups/RestoreController.cs +++ b/backend/src/Squidex/Areas/Api/Controllers/Backups/RestoreController.cs @@ -66,7 +66,7 @@ public class RestoreController : ApiController [ApiPermission(PermissionIds.AdminRestore)] public async Task PostRestoreJob([FromBody] RestoreRequestDto request) { - await backupService.StartRestoreAsync(User.Token()!, request.Url, request.Name); + await backupService.StartRestoreAsync(User.Token()!, request.Url, request.Name, HttpContext.RequestAborted); return NoContent(); } diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/MongoDb/ContentsQueryDedicatedIntegrationTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/MongoDb/ContentsQueryDedicatedIntegrationTests.cs index 5a04f1f41..a734d1c4e 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/MongoDb/ContentsQueryDedicatedIntegrationTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/MongoDb/ContentsQueryDedicatedIntegrationTests.cs @@ -7,9 +7,6 @@ using Xunit; -#pragma warning disable SA1300 // Element should begin with upper-case letter -#pragma warning disable MA0048 // File name must match type name - namespace Squidex.Domain.Apps.Entities.Contents.MongoDb; [Trait("Category", "Dependencies")] diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/MongoDb/ContentsQueryTestsBase.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/MongoDb/ContentsQueryTestsBase.cs index 6ef5300f0..4de91090b 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/MongoDb/ContentsQueryTestsBase.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/MongoDb/ContentsQueryTestsBase.cs @@ -14,7 +14,6 @@ using Xunit; using F = Squidex.Infrastructure.Queries.ClrFilter; #pragma warning disable SA1300 // Element should begin with upper-case letter -#pragma warning disable MA0048 // File name must match type name namespace Squidex.Domain.Apps.Entities.Contents.MongoDb;