From 374d335f9486e9bf8a6a6bbb03f61aaca97df092 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Tue, 12 May 2020 09:14:56 +0200 Subject: [PATCH] Fixes nameof --- .../Actions/Comment/CommentActionHandler.cs | 2 +- .../Actions/Fastly/FastlyActionHandler.cs | 2 +- .../Notification/NotificationActionHandler.cs | 4 +- .../Actions/Slack/SlackActionHandler.cs | 2 +- .../Actions/Twitter/TweetActionHandler.cs | 2 +- .../Actions/Webhook/WebhookActionHandler.cs | 2 +- .../CompositeUniqueValidatorFactory.cs | 2 +- .../Apps/AppClient.cs | 8 ++-- .../Apps/AppClients.cs | 12 +++--- .../Apps/AppContributors.cs | 6 +-- .../Apps/AppImage.cs | 2 +- .../Apps/AppPattern.cs | 2 +- .../Apps/AppPatterns.cs | 4 +- .../Apps/AppPlan.cs | 4 +- .../Apps/LanguagesConfig.cs | 10 ++--- .../Apps/Role.cs | 2 +- .../Apps/Roles.cs | 6 +-- .../Comments/Comment.cs | 6 +-- .../Contents/ContentData.cs | 2 +- .../Contents/ContentFieldData.cs | 2 +- .../Contents/IdContentData.cs | 2 +- .../Contents/NamedContentData.cs | 2 +- .../Contents/Workflows.cs | 8 ++-- .../Squidex.Domain.Apps.Core.Model/Named.cs | 2 +- .../Partitioning.cs | 2 +- .../Rules/Rule.cs | 8 ++-- .../Schemas/ArrayField.cs | 2 +- .../Schemas/FieldCollection.cs | 8 ++-- .../Schemas/NestedField.cs | 4 +- .../Schemas/NestedField{T}.cs | 2 +- .../Schemas/RootField.cs | 6 +-- .../Schemas/RootField{T}.cs | 2 +- .../Schemas/Schema.cs | 4 +- .../Squidex.Domain.Apps.Core.Model.csproj | 1 - .../ConvertContent/ContentConverter.cs | 6 +-- .../ConvertContent/StringFormatter.cs | 2 +- .../DefaultValues/DefaultValueFactory.cs | 2 +- .../DefaultValues/DefaultValueGenerator.cs | 8 ++-- .../SchemaSynchronizer.cs | 4 +- .../ContentReferencesExtensions.cs | 14 +++---- .../ExtractReferenceIds/ReferencesCleaner.cs | 2 +- .../ReferencesExtractor.cs | 2 +- .../GenerateEdmSchema/EdmSchemaExtensions.cs | 4 +- .../ContentSchemaBuilder.cs | 4 +- .../JsonSchemaExtensions.cs | 4 +- .../HandleRules/EventEnricher.cs | 4 +- .../HandleRules/RuleActionHandler.cs | 2 +- .../HandleRules/RuleActionRegistration.cs | 2 +- .../HandleRules/RuleEventFormatter.cs | 6 +-- .../HandleRules/RuleService.cs | 20 +++++----- .../Scripting/EventScriptExtension.cs | 2 +- .../Extensions/HttpScriptExtension.cs | 2 +- .../Scripting/Internal/Parser.cs | 2 +- .../Scripting/JintScriptEngine.cs | 24 ++++++------ .../Tags/TagNormalizer.cs | 10 ++--- .../ValidateContent/ContentValidator.cs | 12 +++--- .../DefaultFieldValueValidatorsFactory.cs | 2 +- .../FieldBagValidatorsFactory.cs | 2 +- .../Validators/AllowedValuesValidator.cs | 2 +- .../Validators/AssetsValidator.cs | 4 +- .../Validators/CollectionItemValidator.cs | 4 +- .../Validators/FieldValidator.cs | 2 +- .../Validators/PatternValidator.cs | 2 +- .../Validators/ReferencesValidator.cs | 2 +- .../Contents/MongoContentCollectionAll.cs | 4 +- .../MongoContentCollectionPublished.cs | 4 +- .../Contents/MongoContentRepository.cs | 4 +- .../Contents/Operations/QueryContent.cs | 2 +- .../Contents/Operations/QueryContentsByIds.cs | 2 +- .../Operations/QueryContentsByQuery.cs | 6 +-- .../Operations/QueryScheduledContents.cs | 2 +- .../FullText/MongoIndexStorage.cs | 2 +- .../Rules/MongoRuleEventRepository.cs | 4 +- .../AppProvider.cs | 8 ++-- .../Apps/AppCommandMiddleware.cs | 6 +-- .../Apps/AppDomainObject.cs | 8 ++-- .../Apps/AppSettingsSearchSource.cs | 2 +- .../Apps/AppUISettings.cs | 2 +- .../Apps/AppUISettingsGrain.cs | 4 +- .../Apps/BackupApps.cs | 6 +-- .../Apps/DefaultAppImageStore.cs | 2 +- .../Apps/DefaultAppLogStore.cs | 4 +- .../Diagnostics/OrleansAppsHealthCheck.cs | 2 +- .../Apps/Guards/GuardApp.cs | 10 ++--- .../Apps/Guards/GuardAppClients.cs | 6 +-- .../Apps/Guards/GuardAppContributors.cs | 4 +- .../Apps/Guards/GuardAppLanguages.cs | 6 +-- .../Apps/Guards/GuardAppPatterns.cs | 6 +-- .../Apps/Guards/GuardAppRoles.cs | 6 +-- .../Apps/Guards/GuardAppWorkflows.cs | 6 +-- .../Apps/Indexes/AppsIndex.cs | 2 +- .../Invitation/InvitationEventConsumer.cs | 6 +-- .../Invitation/InviteUserCommandMiddleware.cs | 2 +- .../Apps/Plans/ConfigAppPlansProvider.cs | 6 +-- .../Apps/Plans/RedirectToCheckoutResult.cs | 2 +- .../Apps/Plans/UsageGate.cs | 8 ++-- .../Apps/Plans/UsageNotifierGrain.cs | 6 +-- .../Apps/RolePermissionsProvider.cs | 2 +- .../Assets/AssetChangedTriggerHandler.cs | 4 +- .../Assets/AssetCommandMiddleware.cs | 10 ++--- .../Assets/AssetDomainObject.cs | 4 +- .../Assets/AssetFolderDomainObject.cs | 2 +- .../Assets/AssetUsageTracker.cs | 2 +- .../Assets/AssetsSearchSource.cs | 4 +- .../Assets/BackupAssets.cs | 6 +-- .../Assets/Guards/GuardAsset.cs | 10 ++--- .../Assets/Guards/GuardAssetFolder.cs | 8 ++-- .../Assets/ImageAssetMetadataSource.cs | 2 +- .../Assets/Queries/AssetEnricher.cs | 14 +++---- .../Assets/Queries/AssetLoader.cs | 2 +- .../Assets/Queries/AssetQueryParser.cs | 8 ++-- .../Assets/Queries/AssetQueryService.cs | 14 +++---- .../Assets/Queries/FilterTagTransformer.cs | 4 +- .../Assets/RecursiveDeleter.cs | 10 ++--- .../Backup/BackupContext.cs | 2 +- .../Backup/BackupContextBase.cs | 2 +- .../Backup/BackupGrain.cs | 18 ++++----- .../Backup/BackupReader.cs | 14 +++---- .../Backup/BackupService.cs | 2 +- .../Backup/BackupWriter.cs | 10 ++--- .../Backup/DefaultBackupArchiveStore.cs | 2 +- .../Backup/RestoreContext.cs | 2 +- .../Backup/RestoreGrain.cs | 26 ++++++------- .../Backup/TempFolderBackupArchiveLocation.cs | 2 +- .../Backup/UserMapping.cs | 18 ++++----- .../Comments/CommentTriggerHandler.cs | 4 +- .../Comments/CommentsCommandMiddleware.cs | 4 +- .../Comments/CommentsGrain.cs | 8 ++-- .../Comments/Guards/GuardComments.cs | 6 +-- .../Contents/BackupContents.cs | 2 +- .../Contents/BulkUpdateCommandMiddleware.cs | 6 +-- .../Contents/ContentChangedTriggerHandler.cs | 4 +- .../Contents/ContentCommandMiddleware.cs | 4 +- .../Contents/ContentDomainObject.cs | 4 +- .../Contents/ContentSchedulerGrain.cs | 8 ++-- .../Contents/ContentsSearchSource.cs | 8 ++-- .../Contents/Counter/CounterGrain.cs | 2 +- .../Counter/CounterScriptExtension.cs | 2 +- .../Contents/DefaultWorkflowsValidator.cs | 4 +- .../Contents/DynamicContentWorkflow.cs | 4 +- .../Contents/GraphQL/CachingGraphQLService.cs | 10 ++--- .../Contents/GraphQL/GraphQLModel.cs | 2 +- .../Contents/GraphQL/Middlewares.cs | 2 +- .../Contents/Guards/GuardContent.cs | 14 +++---- .../Contents/Queries/ContentEnricher.cs | 10 ++--- .../Contents/Queries/ContentLoader.cs | 2 +- .../Contents/Queries/ContentQueryParser.cs | 4 +- .../Contents/Queries/ContentQueryService.cs | 16 ++++---- .../Contents/Queries/FilterTagTransformer.cs | 6 +-- .../Contents/Queries/QueryExecutionContext.cs | 10 ++--- .../Contents/Queries/Steps/ConvertData.cs | 6 +-- .../Queries/Steps/EnrichForCaching.cs | 2 +- .../Queries/Steps/EnrichWithWorkflows.cs | 2 +- .../Contents/Queries/Steps/ResolveAssets.cs | 6 +-- .../Queries/Steps/ResolveReferences.cs | 4 +- .../Contents/Queries/Steps/ScriptContent.cs | 2 +- .../Contents/State/ContentVersion.cs | 2 +- .../Contents/Text/Lucene/IndexManager.cs | 8 ++-- .../Contents/Text/Lucene/IndexManager_Impl.cs | 2 +- .../Contents/Text/Lucene/LuceneTextIndex.cs | 4 +- .../Text/Lucene/LuceneTextIndexGrain.cs | 2 +- .../Text/Lucene/Storage/AssetIndexStorage.cs | 2 +- .../Contents/Text/SearchFilter.cs | 2 +- .../Text/State/CachingTextIndexerState.cs | 4 +- .../Contents/Text/TextIndexingProcess.cs | 4 +- .../Validation/DependencyValidatorsFactory.cs | 4 +- .../Squidex.Domain.Apps.Entities/Context.cs | 2 +- .../EventStoreInitializer.cs | 2 +- .../History/HistoryEvent.cs | 4 +- .../History/HistoryEventsCreatorBase.cs | 4 +- .../History/HistoryService.cs | 4 +- .../Notifications/NotificationEmailSender.cs | 18 ++++----- .../Rules/BackupRules.cs | 2 +- .../Rules/Guards/GuardRule.cs | 10 ++--- .../Rules/Guards/RuleTriggerValidator.cs | 4 +- .../Rules/Indexes/RulesIndex.cs | 2 +- .../Rules/Queries/RuleEnricher.cs | 10 ++--- .../Rules/Queries/RuleQueryService.cs | 4 +- .../Rules/RuleCommandMiddleware.cs | 4 +- .../Rules/RuleDequeuerGrain.cs | 8 ++-- .../Rules/RuleDomainObject.cs | 4 +- .../Rules/RuleEnqueuer.cs | 12 +++--- .../Rules/Runner/GrainRuleRunnerService.cs | 2 +- .../Rules/Runner/RuleRunnerGrain.cs | 14 +++---- .../UsageTrackerCommandMiddleware.cs | 2 +- .../Rules/UsageTracking/UsageTrackerGrain.cs | 4 +- .../Schemas/BackupSchemas.cs | 2 +- .../Schemas/Guards/GuardSchema.cs | 22 +++++------ .../Schemas/Guards/GuardSchemaField.cs | 16 ++++---- .../Schemas/Indexes/SchemasIndex.cs | 2 +- .../Schemas/SchemaChangedTriggerHandler.cs | 2 +- .../Schemas/SchemasSearchSource.cs | 4 +- .../Search/SearchManager.cs | 4 +- .../Tags/GrainTagService.cs | 4 +- .../Tags/TagGrain.cs | 2 +- .../DefaultUserPictureStore.cs | 2 +- .../DefaultUserResolver.cs | 12 +++--- .../DefaultXmlRepository.cs | 2 +- .../PwnedPasswordValidator.cs | 2 +- .../Squidex.Domain.Users/UserWithClaims.cs | 4 +- .../Assets/AmazonS3AssetStore.cs | 10 ++--- .../Assets/SeekFakerStream.cs | 2 +- .../Assets/AzureBlobAssetStore.cs | 20 +++++----- .../EventSourcing/CosmosDbEventStore.cs | 8 ++-- .../CosmosDbEventStore_Reader.cs | 16 ++++---- .../CosmosDbEventStore_Writer.cs | 8 ++-- .../Diagnostics/GetEventStoreHealthCheck.cs | 2 +- .../EventSourcing/GetEventStore.cs | 28 +++++++------- .../Assets/GoogleCloudAssetStore.cs | 14 +++---- .../Assets/MongoGridFsAssetStore.cs | 8 ++-- .../Diagnostics/MongoDBHealthCheck.cs | 2 +- .../EventSourcing/MongoEventStore.cs | 2 +- .../EventSourcing/MongoEventStore_Reader.cs | 16 ++++---- .../EventSourcing/MongoEventStore_Writer.cs | 14 +++---- .../Log/MongoRequestLogRepository.cs | 8 ++-- .../MongoDb/BsonJsonReader.cs | 2 +- .../MongoDb/BsonJsonSerializer.cs | 2 +- .../MongoDb/BsonJsonWriter.cs | 2 +- .../MongoDb/MongoRepositoryBase.cs | 2 +- .../States/MongoSnapshotStore.cs | 2 +- .../UsageTracking/MongoUsageRepository.cs | 2 +- .../CQRS/Events/RabbitMqEventConsumer.cs | 8 ++-- .../Assets/AssetAlreadyExistsException.cs | 2 +- .../Assets/AssetFile.cs | 6 +-- .../Assets/AssetNotFoundException.cs | 2 +- .../Assets/FTPAssetStore.cs | 22 +++++------ .../Assets/FolderAssetStore.cs | 8 ++-- .../Assets/HasherStream.cs | 2 +- .../Assets/ImageInfo.cs | 4 +- .../ImageSharpAssetThumbnailGenerator.cs | 2 +- .../Assets/MemoryAssetStore.cs | 16 ++++---- .../Caching/CachingProviderBase.cs | 2 +- .../Caching/LRUCache.cs | 2 +- .../CollectionExtensions.cs | 2 +- .../ImmutableDictionary{TKey,TValue}.cs | 2 +- .../Commands/CommandContext.cs | 4 +- .../Commands/CustomCommandMiddlewareRunner.cs | 2 +- .../Commands/DomainObject.cs | 2 +- .../Commands/DomainObjectBase.cs | 8 ++-- .../Commands/DomainObjectGrain.cs | 2 +- .../EnrichWithTimestampCommandMiddleware.cs | 2 +- .../Commands/GrainCommandMiddleware.cs | 2 +- .../Commands/InMemoryCommandBus.cs | 4 +- .../Commands/LogCommandMiddleware.cs | 2 +- .../Commands/LogSnapshotDomainObject.cs | 2 +- .../Commands/ReadonlyCommandMiddleware.cs | 2 +- .../Commands/Rebuilder.cs | 10 ++--- .../DelegateDisposable.cs | 2 +- .../Diagnostics/GCHealthCheck.cs | 2 +- .../Diagnostics/OrleansHealthCheck.cs | 2 +- .../Email/SmtpEmailSender.cs | 2 +- .../EventSourcing/CompoundEventConsumer.cs | 10 ++--- .../DefaultEventDataFormatter.cs | 4 +- .../EventSourcing/Envelope{T}.cs | 2 +- .../EventConsumersHealthCheck.cs | 2 +- .../EventSourcing/EventData.cs | 6 +-- .../Grains/EventConsumerGrain.cs | 10 ++--- .../Grains/EventConsumerManagerGrain.cs | 2 +- .../Grains/OrleansEventNotifier.cs | 2 +- .../EventSourcing/PollingSubscription.cs | 4 +- .../EventSourcing/RetrySubscription.cs | 6 +-- .../EventSourcing/StoredEvent.cs | 6 +-- backend/src/Squidex.Infrastructure/Guard.cs | 37 +++++++++---------- .../Newtonsoft/NewtonsoftJsonSerializer.cs | 2 +- .../Newtonsoft/TypeNameSerializationBinder.cs | 2 +- .../Json/Objects/JsonArray.cs | 2 +- .../Json/Objects/JsonObject.cs | 4 +- .../Json/Objects/JsonValue.cs | 2 +- .../src/Squidex.Infrastructure/Language.cs | 6 +-- .../LanguagesInitializer.cs | 2 +- .../Log/Adapter/SemanticLogLoggerProvider.cs | 2 +- .../Log/ApplicationInfoLogAppender.cs | 2 +- .../Log/ConstantsLogWriter.cs | 2 +- .../Squidex.Infrastructure/Log/FileChannel.cs | 2 +- .../Squidex.Infrastructure/Log/Profiler.cs | 2 +- .../Log/ProfilerSession.cs | 4 +- .../Log/ProfilerSpan.cs | 2 +- .../Squidex.Infrastructure/Log/SemanticLog.cs | 12 +++--- .../Log/Store/BackgroundRequestLogStore.cs | 6 +-- .../Migrations/Migrator.cs | 6 +-- .../src/Squidex.Infrastructure/NamedId{T}.cs | 4 +- .../Orleans/ActivationLimit.cs | 4 +- .../Orleans/GrainBootstrap.cs | 2 +- .../Orleans/GrainState.cs | 2 +- .../Orleans/Indexes/IdsIndexGrain.cs | 2 +- .../Orleans/Indexes/UniqueNameIndexGrain.cs | 2 +- .../Orleans/LocalCacheFilter.cs | 2 +- .../Orleans/LoggingFilter.cs | 2 +- .../Orleans/StateFilter.cs | 2 +- .../Plugins/PluginManager.cs | 10 ++--- .../Queries/CompareFilter.cs | 6 +-- .../Queries/LogicalFilter.cs | 4 +- .../Queries/NegateFilter.cs | 2 +- .../Queries/SortNode.cs | 4 +- .../src/Squidex.Infrastructure/RefToken.cs | 4 +- .../Reflection/Internal/PropertyAccessor.cs | 8 ++-- .../Reflection/SimpleMapper.cs | 6 +-- .../Reflection/TypeNameRegistry.cs | 12 +++--- .../Security/Permission.cs | 2 +- .../Security/PermissionSet.cs | 6 +-- .../States/DefaultStreamNameResolver.cs | 8 ++-- .../States/Persistence{TSnapshot,TKey}.cs | 2 +- .../Squidex.Infrastructure/States/Store.cs | 4 +- .../StringExtensions.cs | 4 +- .../Tasks/AsyncLocalCleaner.cs | 2 +- .../Tasks/AsyncLockPool.cs | 4 +- .../Tasks/PartitionedActionBlock.cs | 8 ++-- .../Tasks/SingleThreadedDispatcher.cs | 4 +- .../Tasks/TaskExtensions.cs | 6 +-- .../Timers/CompletionTimer.cs | 4 +- .../Translations/DeepLTranslator.cs | 4 +- .../UsageTracking/ApiUsageTracker.cs | 2 +- .../UsageTracking/BackgroundUsageTracker.cs | 12 +++--- .../UsageTracking/CachingUsageTracker.cs | 10 ++--- .../UsageTracking/StoredUsage.cs | 2 +- .../Validation/ValidationError.cs | 2 +- backend/src/Squidex.Shared/Permissions.cs | 2 +- .../src/Squidex.Shared/Users/ClientUser.cs | 2 +- backend/src/Squidex.Web/ApiController.cs | 2 +- .../src/Squidex.Web/ApiExceptionConverter.cs | 4 +- .../ETagCommandMiddleware.cs | 2 +- .../EnrichWithActorCommandMiddleware.cs | 2 +- .../EnrichWithAppIdCommandMiddleware.cs | 2 +- .../EnrichWithSchemaIdCommandMiddleware.cs | 4 +- backend/src/Squidex.Web/ContextProvider.cs | 2 +- backend/src/Squidex.Web/Deferred.cs | 4 +- backend/src/Squidex.Web/ExposedValues.cs | 4 +- backend/src/Squidex.Web/FileCallbackResult.cs | 2 +- .../Pipeline/ActionContextLogAppender.cs | 4 +- .../Squidex.Web/Pipeline/ApiCostsFilter.cs | 2 +- .../src/Squidex.Web/Pipeline/AppResolver.cs | 2 +- .../src/Squidex.Web/Pipeline/CachingFilter.cs | 4 +- .../Squidex.Web/Pipeline/CachingManager.cs | 8 ++-- .../Pipeline/EnforceHttpsMiddleware.cs | 2 +- .../Pipeline/LocalCacheMiddleware.cs | 2 +- .../Pipeline/RequestExceptionMiddleware.cs | 2 +- .../RequestLogPerformanceMiddleware.cs | 4 +- .../Squidex.Web/Pipeline/SchemaResolver.cs | 2 +- .../Squidex.Web/Pipeline/UsageMiddleware.cs | 6 +-- backend/src/Squidex.Web/Resource.cs | 6 +-- .../src/Squidex.Web/Services/UrlGenerator.cs | 4 +- .../Api/Controllers/Apps/Models/RoleDto.cs | 2 +- .../Assets/Models/AssetContentQueryDto.cs | 2 +- .../EventConsumers/Models/EventConsumerDto.cs | 2 +- .../Rules/Models/RuleActionProcessor.cs | 2 +- .../IdentityServer/Config/LazyClientStore.cs | 8 ++-- .../Pipeline/Robots/RobotsTxtMiddleware.cs | 2 +- backend/tools/Migrate_01/RebuildRunner.cs | 6 +-- frontend/package-lock.json | 6 +-- frontend/package.json | 24 ++++++------ 350 files changed, 896 insertions(+), 898 deletions(-) diff --git a/backend/extensions/Squidex.Extensions/Actions/Comment/CommentActionHandler.cs b/backend/extensions/Squidex.Extensions/Actions/Comment/CommentActionHandler.cs index 2396a0d2e..25f053d9f 100644 --- a/backend/extensions/Squidex.Extensions/Actions/Comment/CommentActionHandler.cs +++ b/backend/extensions/Squidex.Extensions/Actions/Comment/CommentActionHandler.cs @@ -25,7 +25,7 @@ namespace Squidex.Extensions.Actions.Comment public CommentActionHandler(RuleEventFormatter formatter, ICommandBus commandBus) : base(formatter) { - Guard.NotNull(commandBus); + Guard.NotNull(commandBus, nameof(commandBus)); this.commandBus = commandBus; } diff --git a/backend/extensions/Squidex.Extensions/Actions/Fastly/FastlyActionHandler.cs b/backend/extensions/Squidex.Extensions/Actions/Fastly/FastlyActionHandler.cs index 694e6597b..1492b0bfc 100644 --- a/backend/extensions/Squidex.Extensions/Actions/Fastly/FastlyActionHandler.cs +++ b/backend/extensions/Squidex.Extensions/Actions/Fastly/FastlyActionHandler.cs @@ -24,7 +24,7 @@ namespace Squidex.Extensions.Actions.Fastly public FastlyActionHandler(RuleEventFormatter formatter, IHttpClientFactory httpClientFactory) : base(formatter) { - Guard.NotNull(httpClientFactory); + Guard.NotNull(httpClientFactory, nameof(httpClientFactory)); this.httpClientFactory = httpClientFactory; } diff --git a/backend/extensions/Squidex.Extensions/Actions/Notification/NotificationActionHandler.cs b/backend/extensions/Squidex.Extensions/Actions/Notification/NotificationActionHandler.cs index fabcc4589..42f8580de 100644 --- a/backend/extensions/Squidex.Extensions/Actions/Notification/NotificationActionHandler.cs +++ b/backend/extensions/Squidex.Extensions/Actions/Notification/NotificationActionHandler.cs @@ -28,8 +28,8 @@ namespace Squidex.Extensions.Actions.Notification public NotificationActionHandler(RuleEventFormatter formatter, ICommandBus commandBus, IUserResolver userResolver) : base(formatter) { - Guard.NotNull(commandBus); - Guard.NotNull(userResolver); + Guard.NotNull(commandBus, nameof(commandBus)); + Guard.NotNull(userResolver, nameof(userResolver)); this.commandBus = commandBus; diff --git a/backend/extensions/Squidex.Extensions/Actions/Slack/SlackActionHandler.cs b/backend/extensions/Squidex.Extensions/Actions/Slack/SlackActionHandler.cs index ad05ebc38..39779a5b9 100644 --- a/backend/extensions/Squidex.Extensions/Actions/Slack/SlackActionHandler.cs +++ b/backend/extensions/Squidex.Extensions/Actions/Slack/SlackActionHandler.cs @@ -25,7 +25,7 @@ namespace Squidex.Extensions.Actions.Slack public SlackActionHandler(RuleEventFormatter formatter, IHttpClientFactory httpClientFactory) : base(formatter) { - Guard.NotNull(httpClientFactory); + Guard.NotNull(httpClientFactory, nameof(httpClientFactory)); this.httpClientFactory = httpClientFactory; } diff --git a/backend/extensions/Squidex.Extensions/Actions/Twitter/TweetActionHandler.cs b/backend/extensions/Squidex.Extensions/Actions/Twitter/TweetActionHandler.cs index 033a70f03..83c95e790 100644 --- a/backend/extensions/Squidex.Extensions/Actions/Twitter/TweetActionHandler.cs +++ b/backend/extensions/Squidex.Extensions/Actions/Twitter/TweetActionHandler.cs @@ -25,7 +25,7 @@ namespace Squidex.Extensions.Actions.Twitter public TweetActionHandler(RuleEventFormatter formatter, IOptions twitterOptions) : base(formatter) { - Guard.NotNull(twitterOptions); + Guard.NotNull(twitterOptions, nameof(twitterOptions)); this.twitterOptions = twitterOptions.Value; } diff --git a/backend/extensions/Squidex.Extensions/Actions/Webhook/WebhookActionHandler.cs b/backend/extensions/Squidex.Extensions/Actions/Webhook/WebhookActionHandler.cs index 51ed32f40..16cb53a36 100644 --- a/backend/extensions/Squidex.Extensions/Actions/Webhook/WebhookActionHandler.cs +++ b/backend/extensions/Squidex.Extensions/Actions/Webhook/WebhookActionHandler.cs @@ -22,7 +22,7 @@ namespace Squidex.Extensions.Actions.Webhook public WebhookActionHandler(RuleEventFormatter formatter, IHttpClientFactory httpClientFactory) : base(formatter) { - Guard.NotNull(httpClientFactory); + Guard.NotNull(httpClientFactory, nameof(httpClientFactory)); this.httpClientFactory = httpClientFactory; } diff --git a/backend/extensions/Squidex.Extensions/Validation/CompositeUniqueValidatorFactory.cs b/backend/extensions/Squidex.Extensions/Validation/CompositeUniqueValidatorFactory.cs index a2c6ecff0..276f40947 100644 --- a/backend/extensions/Squidex.Extensions/Validation/CompositeUniqueValidatorFactory.cs +++ b/backend/extensions/Squidex.Extensions/Validation/CompositeUniqueValidatorFactory.cs @@ -20,7 +20,7 @@ namespace Squidex.Extensions.Validation public CompositeUniqueValidatorFactory(IContentRepository contentRepository) { - Guard.NotNull(contentRepository); + Guard.NotNull(contentRepository, nameof(contentRepository)); this.contentRepository = contentRepository; } diff --git a/backend/src/Squidex.Domain.Apps.Core.Model/Apps/AppClient.cs b/backend/src/Squidex.Domain.Apps.Core.Model/Apps/AppClient.cs index 8b5035f33..687d59849 100644 --- a/backend/src/Squidex.Domain.Apps.Core.Model/Apps/AppClient.cs +++ b/backend/src/Squidex.Domain.Apps.Core.Model/Apps/AppClient.cs @@ -20,8 +20,8 @@ namespace Squidex.Domain.Apps.Core.Apps public AppClient(string name, string secret, string role) : base(name) { - Guard.NotNullOrEmpty(secret); - Guard.NotNullOrEmpty(role); + Guard.NotNullOrEmpty(secret, nameof(secret)); + Guard.NotNullOrEmpty(role, nameof(role)); Role = role; @@ -31,7 +31,7 @@ namespace Squidex.Domain.Apps.Core.Apps [Pure] public AppClient Update(string newRole) { - Guard.NotNullOrEmpty(newRole); + Guard.NotNullOrEmpty(newRole, nameof(newRole)); return new AppClient(Name, Secret, newRole); } @@ -39,7 +39,7 @@ namespace Squidex.Domain.Apps.Core.Apps [Pure] public AppClient Rename(string newName) { - Guard.NotNullOrEmpty(newName); + Guard.NotNullOrEmpty(newName, nameof(newName)); return new AppClient(newName, Secret, Role); } diff --git a/backend/src/Squidex.Domain.Apps.Core.Model/Apps/AppClients.cs b/backend/src/Squidex.Domain.Apps.Core.Model/Apps/AppClients.cs index aa3de0337..e8caa2f28 100644 --- a/backend/src/Squidex.Domain.Apps.Core.Model/Apps/AppClients.cs +++ b/backend/src/Squidex.Domain.Apps.Core.Model/Apps/AppClients.cs @@ -29,7 +29,7 @@ namespace Squidex.Domain.Apps.Core.Apps [Pure] public AppClients Revoke(string id) { - Guard.NotNullOrEmpty(id); + Guard.NotNullOrEmpty(id, nameof(id)); return Without(id); } @@ -37,8 +37,8 @@ namespace Squidex.Domain.Apps.Core.Apps [Pure] public AppClients Add(string id, AppClient client) { - Guard.NotNullOrEmpty(id); - Guard.NotNull(client); + Guard.NotNullOrEmpty(id, nameof(id)); + Guard.NotNull(client, nameof(client)); return With(id, client); } @@ -46,7 +46,7 @@ namespace Squidex.Domain.Apps.Core.Apps [Pure] public AppClients Add(string id, string secret) { - Guard.NotNullOrEmpty(id); + Guard.NotNullOrEmpty(id, nameof(id)); if (ContainsKey(id)) { @@ -59,7 +59,7 @@ namespace Squidex.Domain.Apps.Core.Apps [Pure] public AppClients Rename(string id, string newName) { - Guard.NotNullOrEmpty(id); + Guard.NotNullOrEmpty(id, nameof(id)); if (!TryGetValue(id, out var client)) { @@ -72,7 +72,7 @@ namespace Squidex.Domain.Apps.Core.Apps [Pure] public AppClients Update(string id, string role) { - Guard.NotNullOrEmpty(id); + Guard.NotNullOrEmpty(id, nameof(id)); if (!TryGetValue(id, out var client)) { diff --git a/backend/src/Squidex.Domain.Apps.Core.Model/Apps/AppContributors.cs b/backend/src/Squidex.Domain.Apps.Core.Model/Apps/AppContributors.cs index 9fbde2df8..7059323c0 100644 --- a/backend/src/Squidex.Domain.Apps.Core.Model/Apps/AppContributors.cs +++ b/backend/src/Squidex.Domain.Apps.Core.Model/Apps/AppContributors.cs @@ -28,8 +28,8 @@ namespace Squidex.Domain.Apps.Core.Apps [Pure] public AppContributors Assign(string contributorId, string role) { - Guard.NotNullOrEmpty(contributorId); - Guard.NotNullOrEmpty(role); + Guard.NotNullOrEmpty(contributorId, nameof(contributorId)); + Guard.NotNullOrEmpty(role, nameof(role)); return With(contributorId, role, EqualityComparer.Default); } @@ -37,7 +37,7 @@ namespace Squidex.Domain.Apps.Core.Apps [Pure] public AppContributors Remove(string contributorId) { - Guard.NotNullOrEmpty(contributorId); + Guard.NotNullOrEmpty(contributorId, nameof(contributorId)); return Without(contributorId); } diff --git a/backend/src/Squidex.Domain.Apps.Core.Model/Apps/AppImage.cs b/backend/src/Squidex.Domain.Apps.Core.Model/Apps/AppImage.cs index 0eb14e3db..c62a41972 100644 --- a/backend/src/Squidex.Domain.Apps.Core.Model/Apps/AppImage.cs +++ b/backend/src/Squidex.Domain.Apps.Core.Model/Apps/AppImage.cs @@ -18,7 +18,7 @@ namespace Squidex.Domain.Apps.Core.Apps public AppImage(string mimeType, string? etag = null) { - Guard.NotNullOrEmpty(mimeType); + Guard.NotNullOrEmpty(mimeType, nameof(mimeType)); MimeType = mimeType; diff --git a/backend/src/Squidex.Domain.Apps.Core.Model/Apps/AppPattern.cs b/backend/src/Squidex.Domain.Apps.Core.Model/Apps/AppPattern.cs index 99c53693e..a4c10d824 100644 --- a/backend/src/Squidex.Domain.Apps.Core.Model/Apps/AppPattern.cs +++ b/backend/src/Squidex.Domain.Apps.Core.Model/Apps/AppPattern.cs @@ -20,7 +20,7 @@ namespace Squidex.Domain.Apps.Core.Apps public AppPattern(string name, string pattern, string? message = null) : base(name) { - Guard.NotNullOrEmpty(pattern); + Guard.NotNullOrEmpty(pattern, nameof(pattern)); Pattern = pattern; diff --git a/backend/src/Squidex.Domain.Apps.Core.Model/Apps/AppPatterns.cs b/backend/src/Squidex.Domain.Apps.Core.Model/Apps/AppPatterns.cs index 90f6656fa..294d1ccc0 100644 --- a/backend/src/Squidex.Domain.Apps.Core.Model/Apps/AppPatterns.cs +++ b/backend/src/Squidex.Domain.Apps.Core.Model/Apps/AppPatterns.cs @@ -43,8 +43,8 @@ namespace Squidex.Domain.Apps.Core.Apps [Pure] public AppPatterns Update(Guid id, string name, string pattern, string? message = null) { - Guard.NotNullOrEmpty(name); - Guard.NotNullOrEmpty(pattern); + Guard.NotNullOrEmpty(name, nameof(name)); + Guard.NotNullOrEmpty(pattern, nameof(pattern)); if (!TryGetValue(id, out var appPattern)) { diff --git a/backend/src/Squidex.Domain.Apps.Core.Model/Apps/AppPlan.cs b/backend/src/Squidex.Domain.Apps.Core.Model/Apps/AppPlan.cs index 2bfaa4a62..5351cb60b 100644 --- a/backend/src/Squidex.Domain.Apps.Core.Model/Apps/AppPlan.cs +++ b/backend/src/Squidex.Domain.Apps.Core.Model/Apps/AppPlan.cs @@ -18,8 +18,8 @@ namespace Squidex.Domain.Apps.Core.Apps public AppPlan(RefToken owner, string planId) { - Guard.NotNull(owner); - Guard.NotNullOrEmpty(planId); + Guard.NotNull(owner, nameof(owner)); + Guard.NotNullOrEmpty(planId, nameof(planId)); Owner = owner; diff --git a/backend/src/Squidex.Domain.Apps.Core.Model/Apps/LanguagesConfig.cs b/backend/src/Squidex.Domain.Apps.Core.Model/Apps/LanguagesConfig.cs index d649af587..e5c6ff2ee 100644 --- a/backend/src/Squidex.Domain.Apps.Core.Model/Apps/LanguagesConfig.cs +++ b/backend/src/Squidex.Domain.Apps.Core.Model/Apps/LanguagesConfig.cs @@ -43,8 +43,8 @@ namespace Squidex.Domain.Apps.Core.Apps public LanguagesConfig(Dictionary languages, string master) { - Guard.NotNull(languages); - Guard.NotNullOrEmpty(master); + Guard.NotNull(languages, nameof(languages)); + Guard.NotNullOrEmpty(master, nameof(master)); Cleanup(languages, ref master); @@ -56,7 +56,7 @@ namespace Squidex.Domain.Apps.Core.Apps [Pure] public LanguagesConfig MakeMaster(Language language) { - Guard.NotNull(language); + Guard.NotNull(language, nameof(language)); return Build(languages, language); } @@ -64,7 +64,7 @@ namespace Squidex.Domain.Apps.Core.Apps [Pure] public LanguagesConfig Set(Language language, bool isOptional = false, params Language[]? fallbacks) { - Guard.NotNull(language); + Guard.NotNull(language, nameof(language)); var newLanguages = new Dictionary(languages) { @@ -77,7 +77,7 @@ namespace Squidex.Domain.Apps.Core.Apps [Pure] public LanguagesConfig Remove(Language language) { - Guard.NotNull(language); + Guard.NotNull(language, nameof(language)); var newLanguages = new Dictionary(languages); diff --git a/backend/src/Squidex.Domain.Apps.Core.Model/Apps/Role.cs b/backend/src/Squidex.Domain.Apps.Core.Model/Apps/Role.cs index fc63aae92..fd1be52b9 100644 --- a/backend/src/Squidex.Domain.Apps.Core.Model/Apps/Role.cs +++ b/backend/src/Squidex.Domain.Apps.Core.Model/Apps/Role.cs @@ -34,7 +34,7 @@ namespace Squidex.Domain.Apps.Core.Apps public Role(string name, PermissionSet permissions) : base(name) { - Guard.NotNull(permissions); + Guard.NotNull(permissions, nameof(permissions)); Permissions = permissions; } diff --git a/backend/src/Squidex.Domain.Apps.Core.Model/Apps/Roles.cs b/backend/src/Squidex.Domain.Apps.Core.Model/Apps/Roles.cs index 69da03ac0..5f9f010f1 100644 --- a/backend/src/Squidex.Domain.Apps.Core.Model/Apps/Roles.cs +++ b/backend/src/Squidex.Domain.Apps.Core.Model/Apps/Roles.cs @@ -107,8 +107,8 @@ namespace Squidex.Domain.Apps.Core.Apps [Pure] public Roles Update(string name, params string[] permissions) { - Guard.NotNullOrEmpty(name); - Guard.NotNull(permissions); + Guard.NotNullOrEmpty(name, nameof(name)); + Guard.NotNull(permissions, nameof(permissions)); if (!inner.TryGetValue(name, out var role)) { @@ -140,7 +140,7 @@ namespace Squidex.Domain.Apps.Core.Apps public bool TryGet(string app, string name, [MaybeNullWhen(false)] out Role value) { - Guard.NotNull(app); + Guard.NotNull(app, nameof(app)); if (Defaults.TryGetValue(name, out var role) || inner.TryGetValue(name, out role)) { diff --git a/backend/src/Squidex.Domain.Apps.Core.Model/Comments/Comment.cs b/backend/src/Squidex.Domain.Apps.Core.Model/Comments/Comment.cs index b8588cf6e..915edb8e8 100644 --- a/backend/src/Squidex.Domain.Apps.Core.Model/Comments/Comment.cs +++ b/backend/src/Squidex.Domain.Apps.Core.Model/Comments/Comment.cs @@ -25,9 +25,9 @@ namespace Squidex.Domain.Apps.Core.Comments public Comment(Guid id, Instant time, RefToken user, string text, Uri? url = null) { - Guard.NotEmpty(id); - Guard.NotNull(user); - Guard.NotNull(text); + Guard.NotEmpty(id, nameof(id)); + Guard.NotNull(user, nameof(user)); + Guard.NotNull(text, nameof(text)); Id = id; Text = text; diff --git a/backend/src/Squidex.Domain.Apps.Core.Model/Contents/ContentData.cs b/backend/src/Squidex.Domain.Apps.Core.Model/Contents/ContentData.cs index 4f7d0cf70..108429fcf 100644 --- a/backend/src/Squidex.Domain.Apps.Core.Model/Contents/ContentData.cs +++ b/backend/src/Squidex.Domain.Apps.Core.Model/Contents/ContentData.cs @@ -37,7 +37,7 @@ namespace Squidex.Domain.Apps.Core.Contents protected static TResult MergeTo(TResult target, params TResult[] sources) where TResult : ContentData { - Guard.NotEmpty(sources); + Guard.NotEmpty(sources, nameof(sources)); if (sources.Length == 1 || sources.Skip(1).All(x => ReferenceEquals(x, sources[0]))) { diff --git a/backend/src/Squidex.Domain.Apps.Core.Model/Contents/ContentFieldData.cs b/backend/src/Squidex.Domain.Apps.Core.Model/Contents/ContentFieldData.cs index 35859d863..656e81abe 100644 --- a/backend/src/Squidex.Domain.Apps.Core.Model/Contents/ContentFieldData.cs +++ b/backend/src/Squidex.Domain.Apps.Core.Model/Contents/ContentFieldData.cs @@ -48,7 +48,7 @@ namespace Squidex.Domain.Apps.Core.Contents public ContentFieldData AddJsonValue(string key, IJsonValue value) { - Guard.NotNullOrEmpty(key); + Guard.NotNullOrEmpty(key, nameof(key)); if (Language.IsValidLanguage(key)) { diff --git a/backend/src/Squidex.Domain.Apps.Core.Model/Contents/IdContentData.cs b/backend/src/Squidex.Domain.Apps.Core.Model/Contents/IdContentData.cs index a4c6c4291..6afddd6b0 100644 --- a/backend/src/Squidex.Domain.Apps.Core.Model/Contents/IdContentData.cs +++ b/backend/src/Squidex.Domain.Apps.Core.Model/Contents/IdContentData.cs @@ -40,7 +40,7 @@ namespace Squidex.Domain.Apps.Core.Contents public IdContentData AddField(long id, ContentFieldData? data) { - Guard.GreaterThan(id, 0); + Guard.GreaterThan(id, 0, nameof(id)); this[id] = data; diff --git a/backend/src/Squidex.Domain.Apps.Core.Model/Contents/NamedContentData.cs b/backend/src/Squidex.Domain.Apps.Core.Model/Contents/NamedContentData.cs index 6e55de3dc..68b536f5c 100644 --- a/backend/src/Squidex.Domain.Apps.Core.Model/Contents/NamedContentData.cs +++ b/backend/src/Squidex.Domain.Apps.Core.Model/Contents/NamedContentData.cs @@ -44,7 +44,7 @@ namespace Squidex.Domain.Apps.Core.Contents public NamedContentData AddField(string name, ContentFieldData? data) { - Guard.NotNullOrEmpty(name); + Guard.NotNullOrEmpty(name, nameof(name)); this[name] = data; diff --git a/backend/src/Squidex.Domain.Apps.Core.Model/Contents/Workflows.cs b/backend/src/Squidex.Domain.Apps.Core.Model/Contents/Workflows.cs index 3e404a2b7..cadf85d76 100644 --- a/backend/src/Squidex.Domain.Apps.Core.Model/Contents/Workflows.cs +++ b/backend/src/Squidex.Domain.Apps.Core.Model/Contents/Workflows.cs @@ -36,7 +36,7 @@ namespace Squidex.Domain.Apps.Core.Contents [Pure] public Workflows Add(Guid workflowId, string name) { - Guard.NotNullOrEmpty(name); + Guard.NotNullOrEmpty(name, nameof(name)); return With(workflowId, Workflow.CreateDefault(name)); } @@ -44,7 +44,7 @@ namespace Squidex.Domain.Apps.Core.Contents [Pure] public Workflows Set(Workflow workflow) { - Guard.NotNull(workflow); + Guard.NotNull(workflow, nameof(workflow)); return With(Guid.Empty, workflow); } @@ -52,7 +52,7 @@ namespace Squidex.Domain.Apps.Core.Contents [Pure] public Workflows Set(Guid id, Workflow workflow) { - Guard.NotNull(workflow); + Guard.NotNull(workflow, nameof(workflow)); return With(id, workflow); } @@ -60,7 +60,7 @@ namespace Squidex.Domain.Apps.Core.Contents [Pure] public Workflows Update(Guid id, Workflow workflow) { - Guard.NotNull(workflow); + Guard.NotNull(workflow, nameof(workflow)); if (id == Guid.Empty) { diff --git a/backend/src/Squidex.Domain.Apps.Core.Model/Named.cs b/backend/src/Squidex.Domain.Apps.Core.Model/Named.cs index 66826f9a2..fd76c4e8f 100644 --- a/backend/src/Squidex.Domain.Apps.Core.Model/Named.cs +++ b/backend/src/Squidex.Domain.Apps.Core.Model/Named.cs @@ -15,7 +15,7 @@ namespace Squidex.Domain.Apps.Core protected Named(string name) { - Guard.NotNullOrEmpty(name); + Guard.NotNullOrEmpty(name, nameof(name)); Name = name; } diff --git a/backend/src/Squidex.Domain.Apps.Core.Model/Partitioning.cs b/backend/src/Squidex.Domain.Apps.Core.Model/Partitioning.cs index d37f73609..fb10cf348 100644 --- a/backend/src/Squidex.Domain.Apps.Core.Model/Partitioning.cs +++ b/backend/src/Squidex.Domain.Apps.Core.Model/Partitioning.cs @@ -21,7 +21,7 @@ namespace Squidex.Domain.Apps.Core public Partitioning(string key) { - Guard.NotNullOrEmpty(key); + Guard.NotNullOrEmpty(key, nameof(key)); Key = key; } diff --git a/backend/src/Squidex.Domain.Apps.Core.Model/Rules/Rule.cs b/backend/src/Squidex.Domain.Apps.Core.Model/Rules/Rule.cs index c3d2073b4..efc195503 100644 --- a/backend/src/Squidex.Domain.Apps.Core.Model/Rules/Rule.cs +++ b/backend/src/Squidex.Domain.Apps.Core.Model/Rules/Rule.cs @@ -40,8 +40,8 @@ namespace Squidex.Domain.Apps.Core.Rules public Rule(RuleTrigger trigger, RuleAction action) { - Guard.NotNull(trigger); - Guard.NotNull(action); + Guard.NotNull(trigger, nameof(trigger)); + Guard.NotNull(action, nameof(action)); SetTrigger(trigger); SetAction(action); @@ -92,7 +92,7 @@ namespace Squidex.Domain.Apps.Core.Rules [Pure] public Rule Update(RuleTrigger newTrigger) { - Guard.NotNull(newTrigger); + Guard.NotNull(newTrigger, nameof(newTrigger)); if (newTrigger.GetType() != trigger.GetType()) { @@ -113,7 +113,7 @@ namespace Squidex.Domain.Apps.Core.Rules [Pure] public Rule Update(RuleAction newAction) { - Guard.NotNull(newAction); + Guard.NotNull(newAction, nameof(newAction)); if (newAction.GetType() != action.GetType()) { diff --git a/backend/src/Squidex.Domain.Apps.Core.Model/Schemas/ArrayField.cs b/backend/src/Squidex.Domain.Apps.Core.Model/Schemas/ArrayField.cs index dffa597bb..1c7578075 100644 --- a/backend/src/Squidex.Domain.Apps.Core.Model/Schemas/ArrayField.cs +++ b/backend/src/Squidex.Domain.Apps.Core.Model/Schemas/ArrayField.cs @@ -44,7 +44,7 @@ namespace Squidex.Domain.Apps.Core.Schemas public ArrayField(long id, string name, Partitioning partitioning, NestedField[] fields, ArrayFieldProperties? properties = null, IFieldSettings? settings = null) : this(id, name, partitioning, properties, settings) { - Guard.NotNull(fields); + Guard.NotNull(fields, nameof(fields)); this.fields = new FieldCollection(fields); } diff --git a/backend/src/Squidex.Domain.Apps.Core.Model/Schemas/FieldCollection.cs b/backend/src/Squidex.Domain.Apps.Core.Model/Schemas/FieldCollection.cs index 9fc87ea9d..c5cb7d4c6 100644 --- a/backend/src/Squidex.Domain.Apps.Core.Model/Schemas/FieldCollection.cs +++ b/backend/src/Squidex.Domain.Apps.Core.Model/Schemas/FieldCollection.cs @@ -78,7 +78,7 @@ namespace Squidex.Domain.Apps.Core.Schemas public FieldCollection(T[] fields) { - Guard.NotNull(fields); + Guard.NotNull(fields, nameof(fields)); fieldsOrdered = fields; } @@ -106,7 +106,7 @@ namespace Squidex.Domain.Apps.Core.Schemas [Pure] public FieldCollection Reorder(List ids) { - Guard.NotNull(ids); + Guard.NotNull(ids, nameof(ids)); if (ids.Count != fieldsOrdered.Length || ids.Any(x => !ById.ContainsKey(x))) { @@ -127,7 +127,7 @@ namespace Squidex.Domain.Apps.Core.Schemas [Pure] public FieldCollection Add(T field) { - Guard.NotNull(field); + Guard.NotNull(field, nameof(field)); if (ByName.ContainsKey(field.Name)) { @@ -148,7 +148,7 @@ namespace Squidex.Domain.Apps.Core.Schemas [Pure] public FieldCollection Update(long fieldId, Func updater) { - Guard.NotNull(updater); + Guard.NotNull(updater, nameof(updater)); if (!ById.TryGetValue(fieldId, out var field)) { diff --git a/backend/src/Squidex.Domain.Apps.Core.Model/Schemas/NestedField.cs b/backend/src/Squidex.Domain.Apps.Core.Model/Schemas/NestedField.cs index 5c0b0cfa0..a28b78659 100644 --- a/backend/src/Squidex.Domain.Apps.Core.Model/Schemas/NestedField.cs +++ b/backend/src/Squidex.Domain.Apps.Core.Model/Schemas/NestedField.cs @@ -47,8 +47,8 @@ namespace Squidex.Domain.Apps.Core.Schemas protected NestedField(long id, string name, IFieldSettings? settings = null) { - Guard.NotNullOrEmpty(name); - Guard.GreaterThan(id, 0); + Guard.NotNullOrEmpty(name, nameof(name)); + Guard.GreaterThan(id, 0, nameof(id)); fieldId = id; fieldName = name; diff --git a/backend/src/Squidex.Domain.Apps.Core.Model/Schemas/NestedField{T}.cs b/backend/src/Squidex.Domain.Apps.Core.Model/Schemas/NestedField{T}.cs index 589244d42..c0c9b1be5 100644 --- a/backend/src/Squidex.Domain.Apps.Core.Model/Schemas/NestedField{T}.cs +++ b/backend/src/Squidex.Domain.Apps.Core.Model/Schemas/NestedField{T}.cs @@ -57,7 +57,7 @@ namespace Squidex.Domain.Apps.Core.Schemas private T ValidateProperties(FieldProperties newProperties) { - Guard.NotNull(newProperties); + Guard.NotNull(newProperties, nameof(newProperties)); if (!(newProperties is T typedProperties)) { diff --git a/backend/src/Squidex.Domain.Apps.Core.Model/Schemas/RootField.cs b/backend/src/Squidex.Domain.Apps.Core.Model/Schemas/RootField.cs index 50cc4e6df..22b71e544 100644 --- a/backend/src/Squidex.Domain.Apps.Core.Model/Schemas/RootField.cs +++ b/backend/src/Squidex.Domain.Apps.Core.Model/Schemas/RootField.cs @@ -53,9 +53,9 @@ namespace Squidex.Domain.Apps.Core.Schemas protected RootField(long id, string name, Partitioning partitioning, IFieldSettings? settings = null) { - Guard.NotNullOrEmpty(name); - Guard.GreaterThan(id, 0); - Guard.NotNull(partitioning); + Guard.NotNullOrEmpty(name, nameof(name)); + Guard.GreaterThan(id, 0, nameof(id)); + Guard.NotNull(partitioning, nameof(partitioning)); fieldId = id; fieldName = name; diff --git a/backend/src/Squidex.Domain.Apps.Core.Model/Schemas/RootField{T}.cs b/backend/src/Squidex.Domain.Apps.Core.Model/Schemas/RootField{T}.cs index 01adb3a15..460540181 100644 --- a/backend/src/Squidex.Domain.Apps.Core.Model/Schemas/RootField{T}.cs +++ b/backend/src/Squidex.Domain.Apps.Core.Model/Schemas/RootField{T}.cs @@ -55,7 +55,7 @@ namespace Squidex.Domain.Apps.Core.Schemas private T ValidateProperties(FieldProperties newProperties) { - Guard.NotNull(newProperties); + Guard.NotNull(newProperties, nameof(newProperties)); if (!(newProperties is T typedProperties)) { diff --git a/backend/src/Squidex.Domain.Apps.Core.Model/Schemas/Schema.cs b/backend/src/Squidex.Domain.Apps.Core.Model/Schemas/Schema.cs index b08a2d27b..54cd45cc6 100644 --- a/backend/src/Squidex.Domain.Apps.Core.Model/Schemas/Schema.cs +++ b/backend/src/Squidex.Domain.Apps.Core.Model/Schemas/Schema.cs @@ -94,7 +94,7 @@ namespace Squidex.Domain.Apps.Core.Schemas public Schema(string name, SchemaProperties? properties = null, bool isSingleton = false) { - Guard.NotNullOrEmpty(name); + Guard.NotNullOrEmpty(name, nameof(name)); this.name = name; @@ -107,7 +107,7 @@ namespace Squidex.Domain.Apps.Core.Schemas public Schema(string name, RootField[] fields, SchemaProperties properties, bool isPublished, bool isSingleton = false) : this(name, properties, isSingleton) { - Guard.NotNull(fields); + Guard.NotNull(fields, nameof(fields)); this.fields = new FieldCollection(fields); diff --git a/backend/src/Squidex.Domain.Apps.Core.Model/Squidex.Domain.Apps.Core.Model.csproj b/backend/src/Squidex.Domain.Apps.Core.Model/Squidex.Domain.Apps.Core.Model.csproj index 2844d5c02..e2559b4a6 100644 --- a/backend/src/Squidex.Domain.Apps.Core.Model/Squidex.Domain.Apps.Core.Model.csproj +++ b/backend/src/Squidex.Domain.Apps.Core.Model/Squidex.Domain.Apps.Core.Model.csproj @@ -2,7 +2,6 @@ netcoreapp3.1 Squidex.Domain.Apps.Core - 8.0 enable diff --git a/backend/src/Squidex.Domain.Apps.Core.Operations/ConvertContent/ContentConverter.cs b/backend/src/Squidex.Domain.Apps.Core.Operations/ConvertContent/ContentConverter.cs index 4575de073..ae9cc05cf 100644 --- a/backend/src/Squidex.Domain.Apps.Core.Operations/ConvertContent/ContentConverter.cs +++ b/backend/src/Squidex.Domain.Apps.Core.Operations/ConvertContent/ContentConverter.cs @@ -17,7 +17,7 @@ namespace Squidex.Domain.Apps.Core.ConvertContent { public static NamedContentData ConvertId2Name(this IdContentData content, Schema schema, params FieldConverter[] converters) { - Guard.NotNull(schema); + Guard.NotNull(schema, nameof(schema)); var result = new NamedContentData(content.Count); @@ -48,7 +48,7 @@ namespace Squidex.Domain.Apps.Core.ConvertContent public static NamedContentData ConvertName2Name(this NamedContentData content, Schema schema, params FieldConverter[] converters) { - Guard.NotNull(schema); + Guard.NotNull(schema, nameof(schema)); var result = new NamedContentData(content.Count); @@ -77,7 +77,7 @@ namespace Squidex.Domain.Apps.Core.ConvertContent public static IdContentData ConvertName2IdCloned(this NamedContentData content, Schema schema, params FieldConverter[] converters) { - Guard.NotNull(schema); + Guard.NotNull(schema, nameof(schema)); var result = new IdContentData(content.Count); diff --git a/backend/src/Squidex.Domain.Apps.Core.Operations/ConvertContent/StringFormatter.cs b/backend/src/Squidex.Domain.Apps.Core.Operations/ConvertContent/StringFormatter.cs index 47d1d6c5d..41ec367a7 100644 --- a/backend/src/Squidex.Domain.Apps.Core.Operations/ConvertContent/StringFormatter.cs +++ b/backend/src/Squidex.Domain.Apps.Core.Operations/ConvertContent/StringFormatter.cs @@ -22,7 +22,7 @@ namespace Squidex.Domain.Apps.Core.ConvertContent public static string Format(IJsonValue? value, IField field) { - Guard.NotNull(field); + Guard.NotNull(field, nameof(field)); if (value == null || value is JsonNull) { diff --git a/backend/src/Squidex.Domain.Apps.Core.Operations/DefaultValues/DefaultValueFactory.cs b/backend/src/Squidex.Domain.Apps.Core.Operations/DefaultValues/DefaultValueFactory.cs index f70e963cd..0b55ddf57 100644 --- a/backend/src/Squidex.Domain.Apps.Core.Operations/DefaultValues/DefaultValueFactory.cs +++ b/backend/src/Squidex.Domain.Apps.Core.Operations/DefaultValues/DefaultValueFactory.cs @@ -24,7 +24,7 @@ namespace Squidex.Domain.Apps.Core.DefaultValues public static IJsonValue CreateDefaultValue(IField field, Instant now) { - Guard.NotNull(field); + Guard.NotNull(field, nameof(field)); return field.Accept(new DefaultValueFactory(now)); } diff --git a/backend/src/Squidex.Domain.Apps.Core.Operations/DefaultValues/DefaultValueGenerator.cs b/backend/src/Squidex.Domain.Apps.Core.Operations/DefaultValues/DefaultValueGenerator.cs index 995cf6d8e..80c2d6275 100644 --- a/backend/src/Squidex.Domain.Apps.Core.Operations/DefaultValues/DefaultValueGenerator.cs +++ b/backend/src/Squidex.Domain.Apps.Core.Operations/DefaultValues/DefaultValueGenerator.cs @@ -20,8 +20,8 @@ namespace Squidex.Domain.Apps.Core.DefaultValues public DefaultValueGenerator(Schema schema, PartitionResolver partitionResolver) { - Guard.NotNull(schema); - Guard.NotNull(partitionResolver); + Guard.NotNull(schema, nameof(schema)); + Guard.NotNull(partitionResolver, nameof(partitionResolver)); this.schema = schema; @@ -30,7 +30,7 @@ namespace Squidex.Domain.Apps.Core.DefaultValues public void Enrich(NamedContentData data) { - Guard.NotNull(data); + Guard.NotNull(data, nameof(data)); foreach (var field in schema.Fields) { @@ -55,7 +55,7 @@ namespace Squidex.Domain.Apps.Core.DefaultValues private static void Enrich(IField field, ContentFieldData fieldData, string partitionKey) { - Guard.NotNull(fieldData); + Guard.NotNull(fieldData, nameof(fieldData)); var defaultValue = DefaultValueFactory.CreateDefaultValue(field, SystemClock.Instance.GetCurrentInstant()); diff --git a/backend/src/Squidex.Domain.Apps.Core.Operations/EventSynchronization/SchemaSynchronizer.cs b/backend/src/Squidex.Domain.Apps.Core.Operations/EventSynchronization/SchemaSynchronizer.cs index 841c7ab1f..37cd8387f 100644 --- a/backend/src/Squidex.Domain.Apps.Core.Operations/EventSynchronization/SchemaSynchronizer.cs +++ b/backend/src/Squidex.Domain.Apps.Core.Operations/EventSynchronization/SchemaSynchronizer.cs @@ -21,8 +21,8 @@ namespace Squidex.Domain.Apps.Core.EventSynchronization public static IEnumerable Synchronize(this Schema source, Schema? target, Func idGenerator, SchemaSynchronizationOptions? options = null) { - Guard.NotNull(source); - Guard.NotNull(idGenerator); + Guard.NotNull(source, nameof(source)); + Guard.NotNull(idGenerator, nameof(idGenerator)); if (target == null) { diff --git a/backend/src/Squidex.Domain.Apps.Core.Operations/ExtractReferenceIds/ContentReferencesExtensions.cs b/backend/src/Squidex.Domain.Apps.Core.Operations/ExtractReferenceIds/ContentReferencesExtensions.cs index a5b61e91e..602fba9a8 100644 --- a/backend/src/Squidex.Domain.Apps.Core.Operations/ExtractReferenceIds/ContentReferencesExtensions.cs +++ b/backend/src/Squidex.Domain.Apps.Core.Operations/ExtractReferenceIds/ContentReferencesExtensions.cs @@ -19,7 +19,7 @@ namespace Squidex.Domain.Apps.Core.ExtractReferenceIds { public static HashSet GetReferencedIds(this NamedContentData source, Schema schema, int referencesPerField = int.MaxValue) { - Guard.NotNull(schema); + Guard.NotNull(schema, nameof(schema)); var extractor = new ReferencesExtractor(new HashSet(), referencesPerField); @@ -30,7 +30,7 @@ namespace Squidex.Domain.Apps.Core.ExtractReferenceIds public static void AddReferencedIds(this NamedContentData source, Schema schema, HashSet result, int referencesPerField = int.MaxValue) { - Guard.NotNull(schema); + Guard.NotNull(schema, nameof(schema)); var extractor = new ReferencesExtractor(result, referencesPerField); @@ -39,7 +39,7 @@ namespace Squidex.Domain.Apps.Core.ExtractReferenceIds public static void AddReferencedIds(this NamedContentData source, IEnumerable fields, HashSet result, int referencesPerField = int.MaxValue) { - Guard.NotNull(fields); + Guard.NotNull(fields, nameof(fields)); var extractor = new ReferencesExtractor(result, referencesPerField); @@ -48,7 +48,7 @@ namespace Squidex.Domain.Apps.Core.ExtractReferenceIds public static void AddReferencedIds(this NamedContentData source, IField field, HashSet result, int referencesPerField = int.MaxValue) { - Guard.NotNull(field); + Guard.NotNull(field, nameof(field)); var extractor = new ReferencesExtractor(result, referencesPerField); @@ -94,8 +94,8 @@ namespace Squidex.Domain.Apps.Core.ExtractReferenceIds public static JsonObject FormatReferences(this NamedContentData data, Schema schema, IFieldPartitioning partitioning, string separator = ", ") { - Guard.NotNull(schema); - Guard.NotNull(partitioning); + Guard.NotNull(schema, nameof(schema)); + Guard.NotNull(partitioning, nameof(partitioning)); var result = JsonValue.Object(); @@ -109,7 +109,7 @@ namespace Squidex.Domain.Apps.Core.ExtractReferenceIds private static string FormatReferenceFields(this NamedContentData data, Schema schema, string partitionKey, string separator) { - Guard.NotNull(schema); + Guard.NotNull(schema, nameof(schema)); var sb = new StringBuilder(); diff --git a/backend/src/Squidex.Domain.Apps.Core.Operations/ExtractReferenceIds/ReferencesCleaner.cs b/backend/src/Squidex.Domain.Apps.Core.Operations/ExtractReferenceIds/ReferencesCleaner.cs index 3cefb32ac..3b5fabcd6 100644 --- a/backend/src/Squidex.Domain.Apps.Core.Operations/ExtractReferenceIds/ReferencesCleaner.cs +++ b/backend/src/Squidex.Domain.Apps.Core.Operations/ExtractReferenceIds/ReferencesCleaner.cs @@ -20,7 +20,7 @@ namespace Squidex.Domain.Apps.Core.ExtractReferenceIds public ReferencesCleaner(HashSet validIds) { - Guard.NotNull(validIds); + Guard.NotNull(validIds, nameof(validIds)); this.validIds = validIds; } diff --git a/backend/src/Squidex.Domain.Apps.Core.Operations/ExtractReferenceIds/ReferencesExtractor.cs b/backend/src/Squidex.Domain.Apps.Core.Operations/ExtractReferenceIds/ReferencesExtractor.cs index 0ebb11896..6c6450055 100644 --- a/backend/src/Squidex.Domain.Apps.Core.Operations/ExtractReferenceIds/ReferencesExtractor.cs +++ b/backend/src/Squidex.Domain.Apps.Core.Operations/ExtractReferenceIds/ReferencesExtractor.cs @@ -27,7 +27,7 @@ namespace Squidex.Domain.Apps.Core.ExtractReferenceIds public ReferencesExtractor(HashSet result, int take) { - Guard.NotNull(result); + Guard.NotNull(result, nameof(result)); this.result = result; diff --git a/backend/src/Squidex.Domain.Apps.Core.Operations/GenerateEdmSchema/EdmSchemaExtensions.cs b/backend/src/Squidex.Domain.Apps.Core.Operations/GenerateEdmSchema/EdmSchemaExtensions.cs index 7ba1813b0..e8238b7d8 100644 --- a/backend/src/Squidex.Domain.Apps.Core.Operations/GenerateEdmSchema/EdmSchemaExtensions.cs +++ b/backend/src/Squidex.Domain.Apps.Core.Operations/GenerateEdmSchema/EdmSchemaExtensions.cs @@ -27,8 +27,8 @@ namespace Squidex.Domain.Apps.Core.GenerateEdmSchema public static EdmComplexType BuildEdmType(this Schema schema, bool withHidden, PartitionResolver partitionResolver, EdmTypeFactory typeFactory) { - Guard.NotNull(typeFactory); - Guard.NotNull(partitionResolver); + Guard.NotNull(typeFactory, nameof(typeFactory)); + Guard.NotNull(partitionResolver, nameof(partitionResolver)); var (edmType, _) = typeFactory("Data"); diff --git a/backend/src/Squidex.Domain.Apps.Core.Operations/GenerateJsonSchema/ContentSchemaBuilder.cs b/backend/src/Squidex.Domain.Apps.Core.Operations/GenerateJsonSchema/ContentSchemaBuilder.cs index 3af3c441c..0328df650 100644 --- a/backend/src/Squidex.Domain.Apps.Core.Operations/GenerateJsonSchema/ContentSchemaBuilder.cs +++ b/backend/src/Squidex.Domain.Apps.Core.Operations/GenerateJsonSchema/ContentSchemaBuilder.cs @@ -15,8 +15,8 @@ namespace Squidex.Domain.Apps.Core.GenerateJsonSchema { public JsonSchema CreateContentSchema(Schema schema, JsonSchema dataSchema) { - Guard.NotNull(schema); - Guard.NotNull(dataSchema); + Guard.NotNull(schema, nameof(schema)); + Guard.NotNull(dataSchema, nameof(dataSchema)); var schemaName = schema.Properties.Label.WithFallback(schema.Name); diff --git a/backend/src/Squidex.Domain.Apps.Core.Operations/GenerateJsonSchema/JsonSchemaExtensions.cs b/backend/src/Squidex.Domain.Apps.Core.Operations/GenerateJsonSchema/JsonSchemaExtensions.cs index 1dc5f49a1..0e6f33524 100644 --- a/backend/src/Squidex.Domain.Apps.Core.Operations/GenerateJsonSchema/JsonSchemaExtensions.cs +++ b/backend/src/Squidex.Domain.Apps.Core.Operations/GenerateJsonSchema/JsonSchemaExtensions.cs @@ -15,8 +15,8 @@ namespace Squidex.Domain.Apps.Core.GenerateJsonSchema { public static JsonSchema BuildJsonSchema(this Schema schema, PartitionResolver partitionResolver, SchemaResolver schemaResolver, bool withHidden = false) { - Guard.NotNull(schemaResolver); - Guard.NotNull(partitionResolver); + Guard.NotNull(schemaResolver, nameof(schemaResolver)); + Guard.NotNull(partitionResolver, nameof(partitionResolver)); var schemaName = schema.Name.ToPascalCase(); diff --git a/backend/src/Squidex.Domain.Apps.Core.Operations/HandleRules/EventEnricher.cs b/backend/src/Squidex.Domain.Apps.Core.Operations/HandleRules/EventEnricher.cs index 7241f15ee..fde694065 100644 --- a/backend/src/Squidex.Domain.Apps.Core.Operations/HandleRules/EventEnricher.cs +++ b/backend/src/Squidex.Domain.Apps.Core.Operations/HandleRules/EventEnricher.cs @@ -24,8 +24,8 @@ namespace Squidex.Domain.Apps.Core.HandleRules public EventEnricher(IMemoryCache userCache, IUserResolver userResolver) { - Guard.NotNull(userCache); - Guard.NotNull(userResolver); + Guard.NotNull(userCache, nameof(userCache)); + Guard.NotNull(userResolver, nameof(userResolver)); this.userCache = userCache; this.userResolver = userResolver; diff --git a/backend/src/Squidex.Domain.Apps.Core.Operations/HandleRules/RuleActionHandler.cs b/backend/src/Squidex.Domain.Apps.Core.Operations/HandleRules/RuleActionHandler.cs index ab4bbbe24..92f0b3256 100644 --- a/backend/src/Squidex.Domain.Apps.Core.Operations/HandleRules/RuleActionHandler.cs +++ b/backend/src/Squidex.Domain.Apps.Core.Operations/HandleRules/RuleActionHandler.cs @@ -32,7 +32,7 @@ namespace Squidex.Domain.Apps.Core.HandleRules protected RuleActionHandler(RuleEventFormatter formatter) { - Guard.NotNull(formatter); + Guard.NotNull(formatter, nameof(formatter)); this.formatter = formatter; } diff --git a/backend/src/Squidex.Domain.Apps.Core.Operations/HandleRules/RuleActionRegistration.cs b/backend/src/Squidex.Domain.Apps.Core.Operations/HandleRules/RuleActionRegistration.cs index e90411d69..2d0477228 100644 --- a/backend/src/Squidex.Domain.Apps.Core.Operations/HandleRules/RuleActionRegistration.cs +++ b/backend/src/Squidex.Domain.Apps.Core.Operations/HandleRules/RuleActionRegistration.cs @@ -16,7 +16,7 @@ namespace Squidex.Domain.Apps.Core.HandleRules internal RuleActionRegistration(Type actionType) { - Guard.NotNull(actionType); + Guard.NotNull(actionType, nameof(actionType)); ActionType = actionType; } diff --git a/backend/src/Squidex.Domain.Apps.Core.Operations/HandleRules/RuleEventFormatter.cs b/backend/src/Squidex.Domain.Apps.Core.Operations/HandleRules/RuleEventFormatter.cs index e206b0214..b555f569d 100644 --- a/backend/src/Squidex.Domain.Apps.Core.Operations/HandleRules/RuleEventFormatter.cs +++ b/backend/src/Squidex.Domain.Apps.Core.Operations/HandleRules/RuleEventFormatter.cs @@ -37,9 +37,9 @@ namespace Squidex.Domain.Apps.Core.HandleRules public RuleEventFormatter(IJsonSerializer jsonSerializer, IUrlGenerator urlGenerator, IScriptEngine scriptEngine) { - Guard.NotNull(jsonSerializer); - Guard.NotNull(scriptEngine); - Guard.NotNull(urlGenerator); + Guard.NotNull(jsonSerializer, nameof(jsonSerializer)); + Guard.NotNull(scriptEngine, nameof(scriptEngine)); + Guard.NotNull(urlGenerator, nameof(urlGenerator)); this.jsonSerializer = jsonSerializer; this.scriptEngine = scriptEngine; diff --git a/backend/src/Squidex.Domain.Apps.Core.Operations/HandleRules/RuleService.cs b/backend/src/Squidex.Domain.Apps.Core.Operations/HandleRules/RuleService.cs index cdda03139..30c74754f 100644 --- a/backend/src/Squidex.Domain.Apps.Core.Operations/HandleRules/RuleService.cs +++ b/backend/src/Squidex.Domain.Apps.Core.Operations/HandleRules/RuleService.cs @@ -44,14 +44,14 @@ namespace Squidex.Domain.Apps.Core.HandleRules ISemanticLog log, TypeNameRegistry typeNameRegistry) { - Guard.NotNull(jsonSerializer); - Guard.NotNull(ruleOptions); - Guard.NotNull(ruleTriggerHandlers); - Guard.NotNull(ruleActionHandlers); - Guard.NotNull(typeNameRegistry); - Guard.NotNull(eventEnricher); - Guard.NotNull(clock); - Guard.NotNull(log); + Guard.NotNull(jsonSerializer, nameof(jsonSerializer)); + Guard.NotNull(ruleOptions, nameof(ruleOptions)); + Guard.NotNull(ruleTriggerHandlers, nameof(ruleTriggerHandlers)); + Guard.NotNull(ruleActionHandlers, nameof(ruleActionHandlers)); + Guard.NotNull(typeNameRegistry, nameof(typeNameRegistry)); + Guard.NotNull(eventEnricher, nameof(eventEnricher)); + Guard.NotNull(clock, nameof(clock)); + Guard.NotNull(log, nameof(log)); this.typeNameRegistry = typeNameRegistry; @@ -69,8 +69,8 @@ namespace Squidex.Domain.Apps.Core.HandleRules public virtual async Task> CreateJobsAsync(Rule rule, Guid ruleId, Envelope @event, bool ignoreStale = false) { - Guard.NotNull(rule); - Guard.NotNull(@event); + Guard.NotNull(rule, nameof(rule)); + Guard.NotNull(@event, nameof(@event)); var result = new List(); diff --git a/backend/src/Squidex.Domain.Apps.Core.Operations/HandleRules/Scripting/EventScriptExtension.cs b/backend/src/Squidex.Domain.Apps.Core.Operations/HandleRules/Scripting/EventScriptExtension.cs index 1a5324deb..c502aa6e3 100644 --- a/backend/src/Squidex.Domain.Apps.Core.Operations/HandleRules/Scripting/EventScriptExtension.cs +++ b/backend/src/Squidex.Domain.Apps.Core.Operations/HandleRules/Scripting/EventScriptExtension.cs @@ -19,7 +19,7 @@ namespace Squidex.Domain.Apps.Core.HandleRules.Scripting public EventScriptExtension(IUrlGenerator urlGenerator) { - Guard.NotNull(urlGenerator); + Guard.NotNull(urlGenerator, nameof(urlGenerator)); this.urlGenerator = urlGenerator; } diff --git a/backend/src/Squidex.Domain.Apps.Core.Operations/Scripting/Extensions/HttpScriptExtension.cs b/backend/src/Squidex.Domain.Apps.Core.Operations/Scripting/Extensions/HttpScriptExtension.cs index 054ca3935..39a3cef00 100644 --- a/backend/src/Squidex.Domain.Apps.Core.Operations/Scripting/Extensions/HttpScriptExtension.cs +++ b/backend/src/Squidex.Domain.Apps.Core.Operations/Scripting/Extensions/HttpScriptExtension.cs @@ -23,7 +23,7 @@ namespace Squidex.Domain.Apps.Core.Scripting.Extensions public HttpScriptExtension(IHttpClientFactory httpClientFactory) { - Guard.NotNull(httpClientFactory); + Guard.NotNull(httpClientFactory, nameof(httpClientFactory)); this.httpClientFactory = httpClientFactory; } diff --git a/backend/src/Squidex.Domain.Apps.Core.Operations/Scripting/Internal/Parser.cs b/backend/src/Squidex.Domain.Apps.Core.Operations/Scripting/Internal/Parser.cs index 9023427ea..b647c1fe5 100644 --- a/backend/src/Squidex.Domain.Apps.Core.Operations/Scripting/Internal/Parser.cs +++ b/backend/src/Squidex.Domain.Apps.Core.Operations/Scripting/Internal/Parser.cs @@ -25,7 +25,7 @@ namespace Squidex.Domain.Apps.Core.Scripting.Internal public Parser(IMemoryCache memoryCache) { - Guard.NotNull(memoryCache); + Guard.NotNull(memoryCache, nameof(memoryCache)); this.memoryCache = memoryCache; } diff --git a/backend/src/Squidex.Domain.Apps.Core.Operations/Scripting/JintScriptEngine.cs b/backend/src/Squidex.Domain.Apps.Core.Operations/Scripting/JintScriptEngine.cs index 82d7e9d6b..a3a798b63 100644 --- a/backend/src/Squidex.Domain.Apps.Core.Operations/Scripting/JintScriptEngine.cs +++ b/backend/src/Squidex.Domain.Apps.Core.Operations/Scripting/JintScriptEngine.cs @@ -42,8 +42,8 @@ namespace Squidex.Domain.Apps.Core.Scripting public async Task ExecuteAsync(ScriptContext context, string script) { - Guard.NotNull(context); - Guard.NotNullOrEmpty(script); + Guard.NotNull(context, nameof(context)); + Guard.NotNullOrEmpty(script, nameof(script)); using (var cts = new CancellationTokenSource(ExecutionTimeout)) { @@ -75,8 +75,8 @@ namespace Squidex.Domain.Apps.Core.Scripting public async Task ExecuteAndTransformAsync(ScriptContext context, string script) { - Guard.NotNull(context); - Guard.NotNullOrEmpty(script); + Guard.NotNull(context, nameof(context)); + Guard.NotNullOrEmpty(script, nameof(script)); using (var cts = new CancellationTokenSource(ExecutionTimeout)) { @@ -128,8 +128,8 @@ namespace Squidex.Domain.Apps.Core.Scripting public async Task TransformAsync(ScriptContext context, string script) { - Guard.NotNull(context); - Guard.NotNullOrEmpty(script); + Guard.NotNull(context, nameof(context)); + Guard.NotNullOrEmpty(script, nameof(script)); using (var cts = new CancellationTokenSource(ExecutionTimeout)) { @@ -178,8 +178,8 @@ namespace Squidex.Domain.Apps.Core.Scripting public bool Evaluate(ScriptContext context, string script) { - Guard.NotNull(context); - Guard.NotNullOrEmpty(script); + Guard.NotNull(context, nameof(context)); + Guard.NotNullOrEmpty(script, nameof(script)); try { @@ -199,8 +199,8 @@ namespace Squidex.Domain.Apps.Core.Scripting public string? Interpolate(ScriptContext context, string script) { - Guard.NotNull(context); - Guard.NotNullOrEmpty(script); + Guard.NotNull(context, nameof(context)); + Guard.NotNullOrEmpty(script, nameof(script)); try { @@ -220,8 +220,8 @@ namespace Squidex.Domain.Apps.Core.Scripting public Task GetAsync(ScriptContext context, string script) { - Guard.NotNull(context); - Guard.NotNullOrEmpty(script); + Guard.NotNull(context, nameof(context)); + Guard.NotNullOrEmpty(script, nameof(script)); using (var cts = new CancellationTokenSource(ExecutionTimeout)) { diff --git a/backend/src/Squidex.Domain.Apps.Core.Operations/Tags/TagNormalizer.cs b/backend/src/Squidex.Domain.Apps.Core.Operations/Tags/TagNormalizer.cs index 8184d8e61..da4ebd983 100644 --- a/backend/src/Squidex.Domain.Apps.Core.Operations/Tags/TagNormalizer.cs +++ b/backend/src/Squidex.Domain.Apps.Core.Operations/Tags/TagNormalizer.cs @@ -19,9 +19,9 @@ namespace Squidex.Domain.Apps.Core.Tags { public static async Task NormalizeAsync(this ITagService tagService, Guid appId, Guid schemaId, Schema schema, NamedContentData newData, NamedContentData? oldData) { - Guard.NotNull(tagService); - Guard.NotNull(schema); - Guard.NotNull(newData); + Guard.NotNull(tagService, nameof(tagService)); + Guard.NotNull(schema, nameof(schema)); + Guard.NotNull(newData, nameof(newData)); var newValues = new HashSet(); var newArrays = new List(); @@ -55,8 +55,8 @@ namespace Squidex.Domain.Apps.Core.Tags public static async Task DenormalizeAsync(this ITagService tagService, Guid appId, Guid schemaId, Schema schema, params NamedContentData[] datas) { - Guard.NotNull(tagService); - Guard.NotNull(schema); + Guard.NotNull(tagService, nameof(tagService)); + Guard.NotNull(schema, nameof(schema)); var tagsValues = new HashSet(); var tagsArrays = new List(); diff --git a/backend/src/Squidex.Domain.Apps.Core.Operations/ValidateContent/ContentValidator.cs b/backend/src/Squidex.Domain.Apps.Core.Operations/ValidateContent/ContentValidator.cs index a3c801460..c32a10c79 100644 --- a/backend/src/Squidex.Domain.Apps.Core.Operations/ValidateContent/ContentValidator.cs +++ b/backend/src/Squidex.Domain.Apps.Core.Operations/ValidateContent/ContentValidator.cs @@ -34,9 +34,9 @@ namespace Squidex.Domain.Apps.Core.ValidateContent public ContentValidator(PartitionResolver partitionResolver, ValidationContext context, IEnumerable factories) { - Guard.NotNull(context); - Guard.NotNull(factories); - Guard.NotNull(partitionResolver); + Guard.NotNull(context, nameof(context)); + Guard.NotNull(factories, nameof(factories)); + Guard.NotNull(partitionResolver, nameof(partitionResolver)); this.context = context; this.factories = factories; @@ -52,7 +52,7 @@ namespace Squidex.Domain.Apps.Core.ValidateContent public Task ValidateInputPartialAsync(NamedContentData data) { - Guard.NotNull(data); + Guard.NotNull(data, nameof(data)); var validator = CreateSchemaValidator(true); @@ -61,7 +61,7 @@ namespace Squidex.Domain.Apps.Core.ValidateContent public Task ValidateInputAsync(NamedContentData data) { - Guard.NotNull(data); + Guard.NotNull(data, nameof(data)); var validator = CreateSchemaValidator(false); @@ -70,7 +70,7 @@ namespace Squidex.Domain.Apps.Core.ValidateContent public Task ValidateContentAsync(NamedContentData data) { - Guard.NotNull(data); + Guard.NotNull(data, nameof(data)); var validator = new AggregateValidator(CreateContentValidators()); diff --git a/backend/src/Squidex.Domain.Apps.Core.Operations/ValidateContent/DefaultFieldValueValidatorsFactory.cs b/backend/src/Squidex.Domain.Apps.Core.Operations/ValidateContent/DefaultFieldValueValidatorsFactory.cs index 7e7c7cdc0..38306da6f 100644 --- a/backend/src/Squidex.Domain.Apps.Core.Operations/ValidateContent/DefaultFieldValueValidatorsFactory.cs +++ b/backend/src/Squidex.Domain.Apps.Core.Operations/ValidateContent/DefaultFieldValueValidatorsFactory.cs @@ -26,7 +26,7 @@ namespace Squidex.Domain.Apps.Core.ValidateContent public static IEnumerable CreateValidators(IField field, FieldValidatorFactory createFieldValidator) { - Guard.NotNull(field); + Guard.NotNull(field, nameof(field)); var visitor = new DefaultFieldValueValidatorsFactory(createFieldValidator); diff --git a/backend/src/Squidex.Domain.Apps.Core.Operations/ValidateContent/FieldBagValidatorsFactory.cs b/backend/src/Squidex.Domain.Apps.Core.Operations/ValidateContent/FieldBagValidatorsFactory.cs index 7d8b842c9..79747c6b8 100644 --- a/backend/src/Squidex.Domain.Apps.Core.Operations/ValidateContent/FieldBagValidatorsFactory.cs +++ b/backend/src/Squidex.Domain.Apps.Core.Operations/ValidateContent/FieldBagValidatorsFactory.cs @@ -22,7 +22,7 @@ namespace Squidex.Domain.Apps.Core.ValidateContent public static IEnumerable CreateValidators(IField field) { - Guard.NotNull(field); + Guard.NotNull(field, nameof(field)); return field.Accept(Instance); } diff --git a/backend/src/Squidex.Domain.Apps.Core.Operations/ValidateContent/Validators/AllowedValuesValidator.cs b/backend/src/Squidex.Domain.Apps.Core.Operations/ValidateContent/Validators/AllowedValuesValidator.cs index 583744302..6d506df4c 100644 --- a/backend/src/Squidex.Domain.Apps.Core.Operations/ValidateContent/Validators/AllowedValuesValidator.cs +++ b/backend/src/Squidex.Domain.Apps.Core.Operations/ValidateContent/Validators/AllowedValuesValidator.cs @@ -23,7 +23,7 @@ namespace Squidex.Domain.Apps.Core.ValidateContent.Validators public AllowedValuesValidator(IEnumerable allowedValues) { - Guard.NotNull(allowedValues); + Guard.NotNull(allowedValues, nameof(allowedValues)); this.allowedValues = allowedValues; } diff --git a/backend/src/Squidex.Domain.Apps.Core.Operations/ValidateContent/Validators/AssetsValidator.cs b/backend/src/Squidex.Domain.Apps.Core.Operations/ValidateContent/Validators/AssetsValidator.cs index 638b7e691..e3fd8e414 100644 --- a/backend/src/Squidex.Domain.Apps.Core.Operations/ValidateContent/Validators/AssetsValidator.cs +++ b/backend/src/Squidex.Domain.Apps.Core.Operations/ValidateContent/Validators/AssetsValidator.cs @@ -24,8 +24,8 @@ namespace Squidex.Domain.Apps.Core.ValidateContent.Validators public AssetsValidator(AssetsFieldProperties properties, CheckAssets checkAssets) { - Guard.NotNull(properties); - Guard.NotNull(checkAssets); + Guard.NotNull(properties, nameof(properties)); + Guard.NotNull(checkAssets, nameof(checkAssets)); this.properties = properties; diff --git a/backend/src/Squidex.Domain.Apps.Core.Operations/ValidateContent/Validators/CollectionItemValidator.cs b/backend/src/Squidex.Domain.Apps.Core.Operations/ValidateContent/Validators/CollectionItemValidator.cs index 6fd866f2b..ec44f68e9 100644 --- a/backend/src/Squidex.Domain.Apps.Core.Operations/ValidateContent/Validators/CollectionItemValidator.cs +++ b/backend/src/Squidex.Domain.Apps.Core.Operations/ValidateContent/Validators/CollectionItemValidator.cs @@ -18,8 +18,8 @@ namespace Squidex.Domain.Apps.Core.ValidateContent.Validators public CollectionItemValidator(params IValidator[] itemValidators) { - Guard.NotNull(itemValidators); - Guard.NotEmpty(itemValidators); + Guard.NotNull(itemValidators, nameof(itemValidators)); + Guard.NotEmpty(itemValidators, nameof(itemValidators)); this.itemValidators = itemValidators; } diff --git a/backend/src/Squidex.Domain.Apps.Core.Operations/ValidateContent/Validators/FieldValidator.cs b/backend/src/Squidex.Domain.Apps.Core.Operations/ValidateContent/Validators/FieldValidator.cs index ec08bcaf8..fd9129962 100644 --- a/backend/src/Squidex.Domain.Apps.Core.Operations/ValidateContent/Validators/FieldValidator.cs +++ b/backend/src/Squidex.Domain.Apps.Core.Operations/ValidateContent/Validators/FieldValidator.cs @@ -21,7 +21,7 @@ namespace Squidex.Domain.Apps.Core.ValidateContent.Validators public FieldValidator(IEnumerable validators, IField field) { - Guard.NotNull(field); + Guard.NotNull(field, nameof(field)); this.validators = validators.ToArray(); diff --git a/backend/src/Squidex.Domain.Apps.Core.Operations/ValidateContent/Validators/PatternValidator.cs b/backend/src/Squidex.Domain.Apps.Core.Operations/ValidateContent/Validators/PatternValidator.cs index 33f794f88..a11336c00 100644 --- a/backend/src/Squidex.Domain.Apps.Core.Operations/ValidateContent/Validators/PatternValidator.cs +++ b/backend/src/Squidex.Domain.Apps.Core.Operations/ValidateContent/Validators/PatternValidator.cs @@ -20,7 +20,7 @@ namespace Squidex.Domain.Apps.Core.ValidateContent.Validators public PatternValidator(string pattern, string? errorMessage = null) { - Guard.NotNullOrEmpty(pattern); + Guard.NotNullOrEmpty(pattern, nameof(pattern)); this.errorMessage = errorMessage; diff --git a/backend/src/Squidex.Domain.Apps.Core.Operations/ValidateContent/Validators/ReferencesValidator.cs b/backend/src/Squidex.Domain.Apps.Core.Operations/ValidateContent/Validators/ReferencesValidator.cs index 8606d5586..8551d0f56 100644 --- a/backend/src/Squidex.Domain.Apps.Core.Operations/ValidateContent/Validators/ReferencesValidator.cs +++ b/backend/src/Squidex.Domain.Apps.Core.Operations/ValidateContent/Validators/ReferencesValidator.cs @@ -22,7 +22,7 @@ namespace Squidex.Domain.Apps.Core.ValidateContent.Validators public ReferencesValidator(IEnumerable? schemaIds, CheckContentsByIds checkReferences) { - Guard.NotNull(checkReferences); + Guard.NotNull(checkReferences, nameof(checkReferences)); this.schemaIds = schemaIds; diff --git a/backend/src/Squidex.Domain.Apps.Entities.MongoDb/Contents/MongoContentCollectionAll.cs b/backend/src/Squidex.Domain.Apps.Entities.MongoDb/Contents/MongoContentCollectionAll.cs index 4a1359e52..9d92b587b 100644 --- a/backend/src/Squidex.Domain.Apps.Entities.MongoDb/Contents/MongoContentCollectionAll.cs +++ b/backend/src/Squidex.Domain.Apps.Entities.MongoDb/Contents/MongoContentCollectionAll.cs @@ -71,7 +71,7 @@ namespace Squidex.Domain.Apps.Entities.MongoDb.Contents public async Task> QueryAsync(IAppEntity app, ISchemaEntity schema, HashSet ids) { - Guard.NotNull(app); + Guard.NotNull(app, nameof(app)); using (Profiler.TraceMethod("QueryAsyncByIds")) { @@ -83,7 +83,7 @@ namespace Squidex.Domain.Apps.Entities.MongoDb.Contents public async Task> QueryAsync(IAppEntity app, HashSet ids) { - Guard.NotNull(app); + Guard.NotNull(app, nameof(app)); using (Profiler.TraceMethod("QueryAsyncByIdsWithoutSchema")) { diff --git a/backend/src/Squidex.Domain.Apps.Entities.MongoDb/Contents/MongoContentCollectionPublished.cs b/backend/src/Squidex.Domain.Apps.Entities.MongoDb/Contents/MongoContentCollectionPublished.cs index b407bfd73..80a1b4574 100644 --- a/backend/src/Squidex.Domain.Apps.Entities.MongoDb/Contents/MongoContentCollectionPublished.cs +++ b/backend/src/Squidex.Domain.Apps.Entities.MongoDb/Contents/MongoContentCollectionPublished.cs @@ -75,7 +75,7 @@ namespace Squidex.Domain.Apps.Entities.MongoDb.Contents public async Task> QueryAsync(IAppEntity app, ISchemaEntity schema, HashSet ids) { - Guard.NotNull(app); + Guard.NotNull(app, nameof(app)); using (Profiler.TraceMethod("QueryAsyncByIds")) { @@ -87,7 +87,7 @@ namespace Squidex.Domain.Apps.Entities.MongoDb.Contents public async Task> QueryAsync(IAppEntity app, HashSet ids) { - Guard.NotNull(app); + Guard.NotNull(app, nameof(app)); using (Profiler.TraceMethod("QueryAsyncByIdsWithoutSchema")) { diff --git a/backend/src/Squidex.Domain.Apps.Entities.MongoDb/Contents/MongoContentRepository.cs b/backend/src/Squidex.Domain.Apps.Entities.MongoDb/Contents/MongoContentRepository.cs index d58cd7713..b84d8406a 100644 --- a/backend/src/Squidex.Domain.Apps.Entities.MongoDb/Contents/MongoContentRepository.cs +++ b/backend/src/Squidex.Domain.Apps.Entities.MongoDb/Contents/MongoContentRepository.cs @@ -37,8 +37,8 @@ namespace Squidex.Domain.Apps.Entities.MongoDb.Contents public MongoContentRepository(IMongoDatabase database, IAppProvider appProvider, ITextIndex indexer, IJsonSerializer serializer) { - Guard.NotNull(appProvider); - Guard.NotNull(serializer); + Guard.NotNull(appProvider, nameof(appProvider)); + Guard.NotNull(serializer, nameof(serializer)); this.appProvider = appProvider; diff --git a/backend/src/Squidex.Domain.Apps.Entities.MongoDb/Contents/Operations/QueryContent.cs b/backend/src/Squidex.Domain.Apps.Entities.MongoDb/Contents/Operations/QueryContent.cs index 822bdd66f..3ecee088c 100644 --- a/backend/src/Squidex.Domain.Apps.Entities.MongoDb/Contents/Operations/QueryContent.cs +++ b/backend/src/Squidex.Domain.Apps.Entities.MongoDb/Contents/Operations/QueryContent.cs @@ -25,7 +25,7 @@ namespace Squidex.Domain.Apps.Entities.MongoDb.Contents.Operations public async Task DoAsync(ISchemaEntity schema, Guid id) { - Guard.NotNull(schema); + Guard.NotNull(schema, nameof(schema)); var find = Collection.Find(x => x.Id == id); diff --git a/backend/src/Squidex.Domain.Apps.Entities.MongoDb/Contents/Operations/QueryContentsByIds.cs b/backend/src/Squidex.Domain.Apps.Entities.MongoDb/Contents/Operations/QueryContentsByIds.cs index 5885fe90a..afa377614 100644 --- a/backend/src/Squidex.Domain.Apps.Entities.MongoDb/Contents/Operations/QueryContentsByIds.cs +++ b/backend/src/Squidex.Domain.Apps.Entities.MongoDb/Contents/Operations/QueryContentsByIds.cs @@ -30,7 +30,7 @@ namespace Squidex.Domain.Apps.Entities.MongoDb.Contents.Operations public async Task> DoAsync(Guid appId, ISchemaEntity? schema, HashSet ids) { - Guard.NotNull(ids); + Guard.NotNull(ids, nameof(ids)); var find = Collection.Find(CreateFilter(appId, ids)); diff --git a/backend/src/Squidex.Domain.Apps.Entities.MongoDb/Contents/Operations/QueryContentsByQuery.cs b/backend/src/Squidex.Domain.Apps.Entities.MongoDb/Contents/Operations/QueryContentsByQuery.cs index 235672625..fcf3dec34 100644 --- a/backend/src/Squidex.Domain.Apps.Entities.MongoDb/Contents/Operations/QueryContentsByQuery.cs +++ b/backend/src/Squidex.Domain.Apps.Entities.MongoDb/Contents/Operations/QueryContentsByQuery.cs @@ -46,9 +46,9 @@ namespace Squidex.Domain.Apps.Entities.MongoDb.Contents.Operations public async Task> DoAsync(IAppEntity app, ISchemaEntity schema, ClrQuery query, SearchScope scope) { - Guard.NotNull(app); - Guard.NotNull(schema); - Guard.NotNull(query); + Guard.NotNull(app, nameof(app)); + Guard.NotNull(schema, nameof(schema)); + Guard.NotNull(query, nameof(query)); try { diff --git a/backend/src/Squidex.Domain.Apps.Entities.MongoDb/Contents/Operations/QueryScheduledContents.cs b/backend/src/Squidex.Domain.Apps.Entities.MongoDb/Contents/Operations/QueryScheduledContents.cs index 686b2ca11..d24133c90 100644 --- a/backend/src/Squidex.Domain.Apps.Entities.MongoDb/Contents/Operations/QueryScheduledContents.cs +++ b/backend/src/Squidex.Domain.Apps.Entities.MongoDb/Contents/Operations/QueryScheduledContents.cs @@ -30,7 +30,7 @@ namespace Squidex.Domain.Apps.Entities.MongoDb.Contents.Operations public Task DoAsync(Instant now, Func callback) { - Guard.NotNull(callback); + Guard.NotNull(callback, nameof(callback)); return Collection.Find(x => x.ScheduledAt < now && x.IsDeleted != true) .Not(x => x.DataByIds) diff --git a/backend/src/Squidex.Domain.Apps.Entities.MongoDb/FullText/MongoIndexStorage.cs b/backend/src/Squidex.Domain.Apps.Entities.MongoDb/FullText/MongoIndexStorage.cs index 18e26a197..fca521983 100644 --- a/backend/src/Squidex.Domain.Apps.Entities.MongoDb/FullText/MongoIndexStorage.cs +++ b/backend/src/Squidex.Domain.Apps.Entities.MongoDb/FullText/MongoIndexStorage.cs @@ -24,7 +24,7 @@ namespace Squidex.Domain.Apps.Entities.MongoDb.FullText public MongoIndexStorage(IGridFSBucket bucket) { - Guard.NotNull(bucket); + Guard.NotNull(bucket, nameof(bucket)); this.bucket = bucket; } diff --git a/backend/src/Squidex.Domain.Apps.Entities.MongoDb/Rules/MongoRuleEventRepository.cs b/backend/src/Squidex.Domain.Apps.Entities.MongoDb/Rules/MongoRuleEventRepository.cs index 5b7097d45..2ed216cb2 100644 --- a/backend/src/Squidex.Domain.Apps.Entities.MongoDb/Rules/MongoRuleEventRepository.cs +++ b/backend/src/Squidex.Domain.Apps.Entities.MongoDb/Rules/MongoRuleEventRepository.cs @@ -107,8 +107,8 @@ namespace Squidex.Domain.Apps.Entities.MongoDb.Rules public async Task UpdateAsync(RuleJob job, RuleJobUpdate update) { - Guard.NotNull(job); - Guard.NotNull(update); + Guard.NotNull(job, nameof(job)); + Guard.NotNull(update, nameof(update)); if (update.ExecutionResult == RuleResult.Success) { diff --git a/backend/src/Squidex.Domain.Apps.Entities/AppProvider.cs b/backend/src/Squidex.Domain.Apps.Entities/AppProvider.cs index 239bfcaad..e28a49e90 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/AppProvider.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/AppProvider.cs @@ -29,10 +29,10 @@ namespace Squidex.Domain.Apps.Entities public AppProvider(ILocalCache localCache, IAppsIndex indexForApps, IRulesIndex indexRules, ISchemasIndex indexSchemas) { - Guard.NotNull(indexForApps); - Guard.NotNull(indexRules); - Guard.NotNull(indexSchemas); - Guard.NotNull(localCache); + Guard.NotNull(indexForApps, nameof(indexForApps)); + Guard.NotNull(indexRules, nameof(indexRules)); + Guard.NotNull(indexSchemas, nameof(indexSchemas)); + Guard.NotNull(localCache, nameof(localCache)); this.localCache = localCache; this.indexForApps = indexForApps; diff --git a/backend/src/Squidex.Domain.Apps.Entities/Apps/AppCommandMiddleware.cs b/backend/src/Squidex.Domain.Apps.Entities/Apps/AppCommandMiddleware.cs index 7aa3ef993..1a0f8c866 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Apps/AppCommandMiddleware.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Apps/AppCommandMiddleware.cs @@ -28,9 +28,9 @@ namespace Squidex.Domain.Apps.Entities.Apps IContextProvider contextProvider) : base(grainFactory) { - Guard.NotNull(contextProvider); - Guard.NotNull(appImageStore); - Guard.NotNull(assetThumbnailGenerator); + Guard.NotNull(contextProvider, nameof(contextProvider)); + Guard.NotNull(appImageStore, nameof(appImageStore)); + Guard.NotNull(assetThumbnailGenerator, nameof(assetThumbnailGenerator)); this.appImageStore = appImageStore; this.assetThumbnailGenerator = assetThumbnailGenerator; diff --git a/backend/src/Squidex.Domain.Apps.Entities/Apps/AppDomainObject.cs b/backend/src/Squidex.Domain.Apps.Entities/Apps/AppDomainObject.cs index 519c7570a..0da6580e0 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Apps/AppDomainObject.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Apps/AppDomainObject.cs @@ -41,10 +41,10 @@ namespace Squidex.Domain.Apps.Entities.Apps IUserResolver userResolver) : base(store, log) { - Guard.NotNull(initialPatterns); - Guard.NotNull(userResolver); - Guard.NotNull(appPlansProvider); - Guard.NotNull(appPlansBillingManager); + Guard.NotNull(initialPatterns, nameof(initialPatterns)); + Guard.NotNull(userResolver, nameof(userResolver)); + Guard.NotNull(appPlansProvider, nameof(appPlansProvider)); + Guard.NotNull(appPlansBillingManager, nameof(appPlansBillingManager)); this.userResolver = userResolver; this.appPlansProvider = appPlansProvider; diff --git a/backend/src/Squidex.Domain.Apps.Entities/Apps/AppSettingsSearchSource.cs b/backend/src/Squidex.Domain.Apps.Entities/Apps/AppSettingsSearchSource.cs index 23a4104b2..46a66ccd3 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Apps/AppSettingsSearchSource.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Apps/AppSettingsSearchSource.cs @@ -21,7 +21,7 @@ namespace Squidex.Domain.Apps.Entities.Apps public AppSettingsSearchSource(IUrlGenerator urlGenerator) { - Guard.NotNull(urlGenerator); + Guard.NotNull(urlGenerator, nameof(urlGenerator)); this.urlGenerator = urlGenerator; } diff --git a/backend/src/Squidex.Domain.Apps.Entities/Apps/AppUISettings.cs b/backend/src/Squidex.Domain.Apps.Entities/Apps/AppUISettings.cs index d8589cab2..55eaea02a 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Apps/AppUISettings.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Apps/AppUISettings.cs @@ -20,7 +20,7 @@ namespace Squidex.Domain.Apps.Entities.Apps public AppUISettings(IGrainFactory grainFactory) { - Guard.NotNull(grainFactory); + Guard.NotNull(grainFactory, nameof(grainFactory)); this.grainFactory = grainFactory; } diff --git a/backend/src/Squidex.Domain.Apps.Entities/Apps/AppUISettingsGrain.cs b/backend/src/Squidex.Domain.Apps.Entities/Apps/AppUISettingsGrain.cs index dbd4ce806..ea6c18642 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Apps/AppUISettingsGrain.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Apps/AppUISettingsGrain.cs @@ -27,7 +27,7 @@ namespace Squidex.Domain.Apps.Entities.Apps public AppUISettingsGrain(IGrainState state) { - Guard.NotNull(state); + Guard.NotNull(state, nameof(state)); this.state = state; } @@ -72,7 +72,7 @@ namespace Squidex.Domain.Apps.Entities.Apps private JsonObject? GetContainer(string path, bool add, out string key) { - Guard.NotNullOrEmpty(path); + Guard.NotNullOrEmpty(path, nameof(path)); var segments = path.Split('.'); diff --git a/backend/src/Squidex.Domain.Apps.Entities/Apps/BackupApps.cs b/backend/src/Squidex.Domain.Apps.Entities/Apps/BackupApps.cs index a561f0c0c..42d0ef196 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Apps/BackupApps.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Apps/BackupApps.cs @@ -33,9 +33,9 @@ namespace Squidex.Domain.Apps.Entities.Apps public BackupApps(IAppImageStore appImageStore, IAppsIndex appsIndex, IAppUISettings appUISettings) { - Guard.NotNull(appImageStore); - Guard.NotNull(appsIndex); - Guard.NotNull(appUISettings); + Guard.NotNull(appImageStore, nameof(appImageStore)); + Guard.NotNull(appsIndex, nameof(appsIndex)); + Guard.NotNull(appUISettings, nameof(appUISettings)); this.appsIndex = appsIndex; this.appImageStore = appImageStore; diff --git a/backend/src/Squidex.Domain.Apps.Entities/Apps/DefaultAppImageStore.cs b/backend/src/Squidex.Domain.Apps.Entities/Apps/DefaultAppImageStore.cs index 2feb0a766..55b09e076 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Apps/DefaultAppImageStore.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Apps/DefaultAppImageStore.cs @@ -20,7 +20,7 @@ namespace Squidex.Domain.Apps.Entities.Apps public DefaultAppImageStore(IAssetStore assetStore) { - Guard.NotNull(assetStore); + Guard.NotNull(assetStore, nameof(assetStore)); this.assetStore = assetStore; } diff --git a/backend/src/Squidex.Domain.Apps.Entities/Apps/DefaultAppLogStore.cs b/backend/src/Squidex.Domain.Apps.Entities/Apps/DefaultAppLogStore.cs index 2c4d84f51..c70a3d40b 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Apps/DefaultAppLogStore.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Apps/DefaultAppLogStore.cs @@ -34,7 +34,7 @@ namespace Squidex.Domain.Apps.Entities.Apps public DefaultAppLogStore(IRequestLogStore requestLogStore) { - Guard.NotNull(requestLogStore); + Guard.NotNull(requestLogStore, nameof(requestLogStore)); this.requestLogStore = requestLogStore; } @@ -63,7 +63,7 @@ namespace Squidex.Domain.Apps.Entities.Apps public async Task ReadLogAsync(Guid appId, DateTime fromDate, DateTime toDate, Stream stream, CancellationToken ct = default) { - Guard.NotNull(appId); + Guard.NotNull(appId, nameof(appId)); var writer = new StreamWriter(stream, Encoding.UTF8, 4096, true); try diff --git a/backend/src/Squidex.Domain.Apps.Entities/Apps/Diagnostics/OrleansAppsHealthCheck.cs b/backend/src/Squidex.Domain.Apps.Entities/Apps/Diagnostics/OrleansAppsHealthCheck.cs index a70ca3f61..729ef1441 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Apps/Diagnostics/OrleansAppsHealthCheck.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Apps/Diagnostics/OrleansAppsHealthCheck.cs @@ -21,7 +21,7 @@ namespace Squidex.Domain.Apps.Entities.Apps.Diagnostics public OrleansAppsHealthCheck(IGrainFactory grainFactory) { - Guard.NotNull(grainFactory); + Guard.NotNull(grainFactory, nameof(grainFactory)); index = grainFactory.GetGrain(SingleGrain.Id); } diff --git a/backend/src/Squidex.Domain.Apps.Entities/Apps/Guards/GuardApp.cs b/backend/src/Squidex.Domain.Apps.Entities/Apps/Guards/GuardApp.cs index 8319ec172..08ae96613 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Apps/Guards/GuardApp.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Apps/Guards/GuardApp.cs @@ -17,7 +17,7 @@ namespace Squidex.Domain.Apps.Entities.Apps.Guards { public static void CanCreate(CreateApp command) { - Guard.NotNull(command); + Guard.NotNull(command, nameof(command)); Validate.It(() => "Cannot create app.", e => { @@ -30,7 +30,7 @@ namespace Squidex.Domain.Apps.Entities.Apps.Guards public static void CanUploadImage(UploadAppImage command) { - Guard.NotNull(command); + Guard.NotNull(command, nameof(command)); Validate.It(() => "Cannot upload image.", e => { @@ -43,17 +43,17 @@ namespace Squidex.Domain.Apps.Entities.Apps.Guards public static void CanUpdate(UpdateApp command) { - Guard.NotNull(command); + Guard.NotNull(command, nameof(command)); } public static void CanRemoveImage(RemoveAppImage command) { - Guard.NotNull(command); + Guard.NotNull(command, nameof(command)); } public static void CanChangePlan(ChangePlan command, AppPlan? plan, IAppPlansProvider appPlans) { - Guard.NotNull(command); + Guard.NotNull(command, nameof(command)); Validate.It(() => "Cannot change plan.", e => { diff --git a/backend/src/Squidex.Domain.Apps.Entities/Apps/Guards/GuardAppClients.cs b/backend/src/Squidex.Domain.Apps.Entities/Apps/Guards/GuardAppClients.cs index 914d578dc..a3828ffaf 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Apps/Guards/GuardAppClients.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Apps/Guards/GuardAppClients.cs @@ -16,7 +16,7 @@ namespace Squidex.Domain.Apps.Entities.Apps.Guards { public static void CanAttach(AppClients clients, AttachClient command) { - Guard.NotNull(command); + Guard.NotNull(command, nameof(command)); Validate.It(() => "Cannot attach client.", e => { @@ -33,7 +33,7 @@ namespace Squidex.Domain.Apps.Entities.Apps.Guards public static void CanRevoke(AppClients clients, RevokeClient command) { - Guard.NotNull(command); + Guard.NotNull(command, nameof(command)); GetClientOrThrow(clients, command.Id); @@ -48,7 +48,7 @@ namespace Squidex.Domain.Apps.Entities.Apps.Guards public static void CanUpdate(AppClients clients, UpdateClient command, Roles roles) { - Guard.NotNull(command); + Guard.NotNull(command, nameof(command)); GetClientOrThrow(clients, command.Id); diff --git a/backend/src/Squidex.Domain.Apps.Entities/Apps/Guards/GuardAppContributors.cs b/backend/src/Squidex.Domain.Apps.Entities/Apps/Guards/GuardAppContributors.cs index d6e8d7b5c..f6cb10e23 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Apps/Guards/GuardAppContributors.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Apps/Guards/GuardAppContributors.cs @@ -21,7 +21,7 @@ namespace Squidex.Domain.Apps.Entities.Apps.Guards { public static Task CanAssign(AppContributors contributors, Roles roles, AssignContributor command, IUserResolver users, IAppLimitsPlan? plan) { - Guard.NotNull(command); + Guard.NotNull(command, nameof(command)); return Validate.It(() => "Cannot assign contributor.", async e => { @@ -64,7 +64,7 @@ namespace Squidex.Domain.Apps.Entities.Apps.Guards public static void CanRemove(AppContributors contributors, RemoveContributor command) { - Guard.NotNull(command); + Guard.NotNull(command, nameof(command)); Validate.It(() => "Cannot remove contributor.", e => { diff --git a/backend/src/Squidex.Domain.Apps.Entities/Apps/Guards/GuardAppLanguages.cs b/backend/src/Squidex.Domain.Apps.Entities/Apps/Guards/GuardAppLanguages.cs index f9df70c0e..66ff0fe99 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Apps/Guards/GuardAppLanguages.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Apps/Guards/GuardAppLanguages.cs @@ -16,7 +16,7 @@ namespace Squidex.Domain.Apps.Entities.Apps.Guards { public static void CanAdd(LanguagesConfig languages, AddLanguage command) { - Guard.NotNull(command); + Guard.NotNull(command, nameof(command)); Validate.It(() => "Cannot add language.", e => { @@ -35,7 +35,7 @@ namespace Squidex.Domain.Apps.Entities.Apps.Guards public static void CanRemove(LanguagesConfig languages, RemoveLanguage command) { - Guard.NotNull(command); + Guard.NotNull(command, nameof(command)); Validate.It(() => "Cannot remove language.", e => { @@ -59,7 +59,7 @@ namespace Squidex.Domain.Apps.Entities.Apps.Guards public static void CanUpdate(LanguagesConfig languages, UpdateLanguage command) { - Guard.NotNull(command); + Guard.NotNull(command, nameof(command)); Validate.It(() => "Cannot update language.", e => { diff --git a/backend/src/Squidex.Domain.Apps.Entities/Apps/Guards/GuardAppPatterns.cs b/backend/src/Squidex.Domain.Apps.Entities/Apps/Guards/GuardAppPatterns.cs index 0cdbe18f0..d5c0437d9 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Apps/Guards/GuardAppPatterns.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Apps/Guards/GuardAppPatterns.cs @@ -17,7 +17,7 @@ namespace Squidex.Domain.Apps.Entities.Apps.Guards { public static void CanAdd(AppPatterns patterns, AddPattern command) { - Guard.NotNull(command); + Guard.NotNull(command, nameof(command)); Validate.It(() => "Cannot add pattern.", e => { @@ -54,7 +54,7 @@ namespace Squidex.Domain.Apps.Entities.Apps.Guards public static void CanDelete(AppPatterns patterns, DeletePattern command) { - Guard.NotNull(command); + Guard.NotNull(command, nameof(command)); if (!patterns.ContainsKey(command.PatternId)) { @@ -64,7 +64,7 @@ namespace Squidex.Domain.Apps.Entities.Apps.Guards public static void CanUpdate(AppPatterns patterns, UpdatePattern command) { - Guard.NotNull(command); + Guard.NotNull(command, nameof(command)); if (!patterns.ContainsKey(command.PatternId)) { diff --git a/backend/src/Squidex.Domain.Apps.Entities/Apps/Guards/GuardAppRoles.cs b/backend/src/Squidex.Domain.Apps.Entities/Apps/Guards/GuardAppRoles.cs index 929bd0692..bd75bc92e 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Apps/Guards/GuardAppRoles.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Apps/Guards/GuardAppRoles.cs @@ -18,7 +18,7 @@ namespace Squidex.Domain.Apps.Entities.Apps.Guards { public static void CanAdd(Roles roles, AddRole command) { - Guard.NotNull(command); + Guard.NotNull(command, nameof(command)); Validate.It(() => "Cannot add role.", e => { @@ -35,7 +35,7 @@ namespace Squidex.Domain.Apps.Entities.Apps.Guards public static void CanDelete(Roles roles, DeleteRole command, AppContributors contributors, AppClients clients) { - Guard.NotNull(command); + Guard.NotNull(command, nameof(command)); CheckRoleExists(roles, command.Name); @@ -64,7 +64,7 @@ namespace Squidex.Domain.Apps.Entities.Apps.Guards public static void CanUpdate(Roles roles, UpdateRole command) { - Guard.NotNull(command); + Guard.NotNull(command, nameof(command)); CheckRoleExists(roles, command.Name); diff --git a/backend/src/Squidex.Domain.Apps.Entities/Apps/Guards/GuardAppWorkflows.cs b/backend/src/Squidex.Domain.Apps.Entities/Apps/Guards/GuardAppWorkflows.cs index 98e455a8d..bbff8ca5d 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Apps/Guards/GuardAppWorkflows.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Apps/Guards/GuardAppWorkflows.cs @@ -17,7 +17,7 @@ namespace Squidex.Domain.Apps.Entities.Apps.Guards { public static void CanAdd(AddWorkflow command) { - Guard.NotNull(command); + Guard.NotNull(command, nameof(command)); Validate.It(() => "Cannot add workflow.", e => { @@ -30,7 +30,7 @@ namespace Squidex.Domain.Apps.Entities.Apps.Guards public static void CanUpdate(Workflows workflows, UpdateWorkflow command) { - Guard.NotNull(command); + Guard.NotNull(command, nameof(command)); CheckWorkflowExists(workflows, command.WorkflowId); @@ -92,7 +92,7 @@ namespace Squidex.Domain.Apps.Entities.Apps.Guards public static void CanDelete(Workflows workflows, DeleteWorkflow command) { - Guard.NotNull(command); + Guard.NotNull(command, nameof(command)); CheckWorkflowExists(workflows, command.WorkflowId); } diff --git a/backend/src/Squidex.Domain.Apps.Entities/Apps/Indexes/AppsIndex.cs b/backend/src/Squidex.Domain.Apps.Entities/Apps/Indexes/AppsIndex.cs index 3474524d7..abfac7046 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Apps/Indexes/AppsIndex.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Apps/Indexes/AppsIndex.cs @@ -27,7 +27,7 @@ namespace Squidex.Domain.Apps.Entities.Apps.Indexes public AppsIndex(IGrainFactory grainFactory) { - Guard.NotNull(grainFactory); + Guard.NotNull(grainFactory, nameof(grainFactory)); this.grainFactory = grainFactory; } diff --git a/backend/src/Squidex.Domain.Apps.Entities/Apps/Invitation/InvitationEventConsumer.cs b/backend/src/Squidex.Domain.Apps.Entities/Apps/Invitation/InvitationEventConsumer.cs index 9e66713c2..a2f6d47b8 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Apps/Invitation/InvitationEventConsumer.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Apps/Invitation/InvitationEventConsumer.cs @@ -35,9 +35,9 @@ namespace Squidex.Domain.Apps.Entities.Apps.Invitation public InvitationEventConsumer(INotificationSender emailSender, IUserResolver userResolver, ISemanticLog log) { - Guard.NotNull(emailSender); - Guard.NotNull(userResolver); - Guard.NotNull(log); + Guard.NotNull(emailSender, nameof(emailSender)); + Guard.NotNull(userResolver, nameof(userResolver)); + Guard.NotNull(log, nameof(log)); this.emailSender = emailSender; this.userResolver = userResolver; diff --git a/backend/src/Squidex.Domain.Apps.Entities/Apps/Invitation/InviteUserCommandMiddleware.cs b/backend/src/Squidex.Domain.Apps.Entities/Apps/Invitation/InviteUserCommandMiddleware.cs index 7700bcdaa..f20f104a4 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Apps/Invitation/InviteUserCommandMiddleware.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Apps/Invitation/InviteUserCommandMiddleware.cs @@ -19,7 +19,7 @@ namespace Squidex.Domain.Apps.Entities.Apps.Invitation public InviteUserCommandMiddleware(IUserResolver userResolver) { - Guard.NotNull(userResolver); + Guard.NotNull(userResolver, nameof(userResolver)); this.userResolver = userResolver; } diff --git a/backend/src/Squidex.Domain.Apps.Entities/Apps/Plans/ConfigAppPlansProvider.cs b/backend/src/Squidex.Domain.Apps.Entities/Apps/Plans/ConfigAppPlansProvider.cs index c31797bf6..cdcb4bbed 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Apps/Plans/ConfigAppPlansProvider.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Apps/Plans/ConfigAppPlansProvider.cs @@ -29,7 +29,7 @@ namespace Squidex.Domain.Apps.Entities.Apps.Plans public ConfigAppPlansProvider(IEnumerable config) { - Guard.NotNull(config); + Guard.NotNull(config, nameof(config)); foreach (var plan in config.OrderBy(x => x.MaxApiCalls).Select(x => x.Clone())) { @@ -65,7 +65,7 @@ namespace Squidex.Domain.Apps.Entities.Apps.Plans public IAppLimitsPlan? GetPlanUpgradeForApp(IAppEntity app) { - Guard.NotNull(app); + Guard.NotNull(app, nameof(app)); return GetPlanUpgrade(app.Plan?.PlanId); } @@ -86,7 +86,7 @@ namespace Squidex.Domain.Apps.Entities.Apps.Plans public (IAppLimitsPlan Plan, string PlanId) GetPlanForApp(IAppEntity app) { - Guard.NotNull(app); + Guard.NotNull(app, nameof(app)); var planId = app.Plan?.PlanId; var plan = GetPlanCore(planId); diff --git a/backend/src/Squidex.Domain.Apps.Entities/Apps/Plans/RedirectToCheckoutResult.cs b/backend/src/Squidex.Domain.Apps.Entities/Apps/Plans/RedirectToCheckoutResult.cs index 6aa19c3c6..920a1f478 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Apps/Plans/RedirectToCheckoutResult.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Apps/Plans/RedirectToCheckoutResult.cs @@ -16,7 +16,7 @@ namespace Squidex.Domain.Apps.Entities.Apps.Plans public RedirectToCheckoutResult(Uri url) { - Guard.NotNull(url); + Guard.NotNull(url, nameof(url)); Url = url; } diff --git a/backend/src/Squidex.Domain.Apps.Entities/Apps/Plans/UsageGate.cs b/backend/src/Squidex.Domain.Apps.Entities/Apps/Plans/UsageGate.cs index 198b703e3..fd2f7ce42 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Apps/Plans/UsageGate.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Apps/Plans/UsageGate.cs @@ -28,9 +28,9 @@ namespace Squidex.Domain.Apps.Entities.Apps.Plans public UsageGate(IAppPlansProvider appPlansProvider, IApiUsageTracker apiUsageTracker, IGrainFactory grainFactory) { - Guard.NotNull(apiUsageTracker); - Guard.NotNull(appPlansProvider); - Guard.NotNull(grainFactory); + Guard.NotNull(apiUsageTracker, nameof(apiUsageTracker)); + Guard.NotNull(appPlansProvider, nameof(appPlansProvider)); + Guard.NotNull(grainFactory, nameof(grainFactory)); this.appPlansProvider = appPlansProvider; this.apiUsageTracker = apiUsageTracker; @@ -40,7 +40,7 @@ namespace Squidex.Domain.Apps.Entities.Apps.Plans public virtual async Task IsBlockedAsync(IAppEntity app, DateTime today) { - Guard.NotNull(app); + Guard.NotNull(app, nameof(app)); var isLocked = false; diff --git a/backend/src/Squidex.Domain.Apps.Entities/Apps/Plans/UsageNotifierGrain.cs b/backend/src/Squidex.Domain.Apps.Entities/Apps/Plans/UsageNotifierGrain.cs index c984376fe..5204512d6 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Apps/Plans/UsageNotifierGrain.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Apps/Plans/UsageNotifierGrain.cs @@ -32,9 +32,9 @@ namespace Squidex.Domain.Apps.Entities.Apps.Plans public UsageNotifierGrain(IGrainState state, INotificationSender notificationSender, IUserResolver userResolver) { - Guard.NotNull(state); - Guard.NotNull(notificationSender); - Guard.NotNull(userResolver); + Guard.NotNull(state, nameof(state)); + Guard.NotNull(notificationSender, nameof(notificationSender)); + Guard.NotNull(userResolver, nameof(userResolver)); this.state = state; this.notificationSender = notificationSender; diff --git a/backend/src/Squidex.Domain.Apps.Entities/Apps/RolePermissionsProvider.cs b/backend/src/Squidex.Domain.Apps.Entities/Apps/RolePermissionsProvider.cs index c2c2e100f..a5db89f6f 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Apps/RolePermissionsProvider.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Apps/RolePermissionsProvider.cs @@ -22,7 +22,7 @@ namespace Squidex.Domain.Apps.Entities.Apps public RolePermissionsProvider(IAppProvider appProvider) { - Guard.NotNull(appProvider); + Guard.NotNull(appProvider, nameof(appProvider)); this.appProvider = appProvider; } diff --git a/backend/src/Squidex.Domain.Apps.Entities/Assets/AssetChangedTriggerHandler.cs b/backend/src/Squidex.Domain.Apps.Entities/Assets/AssetChangedTriggerHandler.cs index ac966bb16..64207be6d 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Assets/AssetChangedTriggerHandler.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Assets/AssetChangedTriggerHandler.cs @@ -24,8 +24,8 @@ namespace Squidex.Domain.Apps.Entities.Assets public AssetChangedTriggerHandler(IScriptEngine scriptEngine, IAssetLoader assetLoader) { - Guard.NotNull(scriptEngine); - Guard.NotNull(assetLoader); + Guard.NotNull(scriptEngine, nameof(scriptEngine)); + Guard.NotNull(assetLoader, nameof(assetLoader)); this.scriptEngine = scriptEngine; diff --git a/backend/src/Squidex.Domain.Apps.Entities/Assets/AssetCommandMiddleware.cs b/backend/src/Squidex.Domain.Apps.Entities/Assets/AssetCommandMiddleware.cs index e1e6308e6..33bac4b6d 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Assets/AssetCommandMiddleware.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Assets/AssetCommandMiddleware.cs @@ -33,11 +33,11 @@ namespace Squidex.Domain.Apps.Entities.Assets IEnumerable assetMetadataSources) : base(grainFactory) { - Guard.NotNull(assetEnricher); - Guard.NotNull(assetFileStore); - Guard.NotNull(assetQuery); - Guard.NotNull(assetMetadataSources); - Guard.NotNull(contextProvider); + Guard.NotNull(assetEnricher, nameof(assetEnricher)); + Guard.NotNull(assetFileStore, nameof(assetFileStore)); + Guard.NotNull(assetQuery, nameof(assetQuery)); + Guard.NotNull(assetMetadataSources, nameof(assetMetadataSources)); + Guard.NotNull(contextProvider, nameof(contextProvider)); this.assetFileStore = assetFileStore; this.assetEnricher = assetEnricher; diff --git a/backend/src/Squidex.Domain.Apps.Entities/Assets/AssetDomainObject.cs b/backend/src/Squidex.Domain.Apps.Entities/Assets/AssetDomainObject.cs index 244b595eb..146c59a7e 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Assets/AssetDomainObject.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Assets/AssetDomainObject.cs @@ -31,8 +31,8 @@ namespace Squidex.Domain.Apps.Entities.Assets public AssetDomainObject(IStore store, ITagService tagService, IAssetQueryService assetQuery, ISemanticLog log) : base(store, log) { - Guard.NotNull(tagService); - Guard.NotNull(assetQuery); + Guard.NotNull(tagService, nameof(tagService)); + Guard.NotNull(assetQuery, nameof(assetQuery)); this.tagService = tagService; diff --git a/backend/src/Squidex.Domain.Apps.Entities/Assets/AssetFolderDomainObject.cs b/backend/src/Squidex.Domain.Apps.Entities/Assets/AssetFolderDomainObject.cs index 529ab301f..30ca258ed 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Assets/AssetFolderDomainObject.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Assets/AssetFolderDomainObject.cs @@ -28,7 +28,7 @@ namespace Squidex.Domain.Apps.Entities.Assets public AssetFolderDomainObject(IStore store, IAssetQueryService assetQuery, ISemanticLog log) : base(store, log) { - Guard.NotNull(assetQuery); + Guard.NotNull(assetQuery, nameof(assetQuery)); this.assetQuery = assetQuery; } diff --git a/backend/src/Squidex.Domain.Apps.Entities/Assets/AssetUsageTracker.cs b/backend/src/Squidex.Domain.Apps.Entities/Assets/AssetUsageTracker.cs index edd3b9e75..6a3a7680b 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Assets/AssetUsageTracker.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Assets/AssetUsageTracker.cs @@ -25,7 +25,7 @@ namespace Squidex.Domain.Apps.Entities.Assets public AssetUsageTracker(IUsageTracker usageTracker) { - Guard.NotNull(usageTracker); + Guard.NotNull(usageTracker, nameof(usageTracker)); this.usageTracker = usageTracker; } diff --git a/backend/src/Squidex.Domain.Apps.Entities/Assets/AssetsSearchSource.cs b/backend/src/Squidex.Domain.Apps.Entities/Assets/AssetsSearchSource.cs index 30f386fb5..0a1f4c342 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Assets/AssetsSearchSource.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Assets/AssetsSearchSource.cs @@ -22,8 +22,8 @@ namespace Squidex.Domain.Apps.Entities.Assets public AssetsSearchSource(IAssetQueryService assetQuery, IUrlGenerator urlGenerator) { - Guard.NotNull(assetQuery); - Guard.NotNull(urlGenerator); + Guard.NotNull(assetQuery, nameof(assetQuery)); + Guard.NotNull(urlGenerator, nameof(urlGenerator)); this.assetQuery = assetQuery; diff --git a/backend/src/Squidex.Domain.Apps.Entities/Assets/BackupAssets.cs b/backend/src/Squidex.Domain.Apps.Entities/Assets/BackupAssets.cs index 61df1d02f..e9c25af37 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Assets/BackupAssets.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Assets/BackupAssets.cs @@ -31,9 +31,9 @@ namespace Squidex.Domain.Apps.Entities.Assets public BackupAssets(Rebuilder rebuilder, IAssetFileStore assetFileStore, ITagService tagService) { - Guard.NotNull(rebuilder); - Guard.NotNull(assetFileStore); - Guard.NotNull(tagService); + Guard.NotNull(rebuilder, nameof(rebuilder)); + Guard.NotNull(assetFileStore, nameof(assetFileStore)); + Guard.NotNull(tagService, nameof(tagService)); this.rebuilder = rebuilder; this.assetFileStore = assetFileStore; diff --git a/backend/src/Squidex.Domain.Apps.Entities/Assets/Guards/GuardAsset.cs b/backend/src/Squidex.Domain.Apps.Entities/Assets/Guards/GuardAsset.cs index a9b4573b8..ad157b704 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Assets/Guards/GuardAsset.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Assets/Guards/GuardAsset.cs @@ -17,7 +17,7 @@ namespace Squidex.Domain.Apps.Entities.Assets.Guards { public static void CanAnnotate(AnnotateAsset command) { - Guard.NotNull(command); + Guard.NotNull(command, nameof(command)); Validate.It(() => "Cannot annotate asset.", e => { @@ -39,7 +39,7 @@ namespace Squidex.Domain.Apps.Entities.Assets.Guards public static Task CanCreate(CreateAsset command, IAssetQueryService assetQuery) { - Guard.NotNull(command); + Guard.NotNull(command, nameof(command)); return Validate.It(() => "Cannot upload asset.", async e => { @@ -49,7 +49,7 @@ namespace Squidex.Domain.Apps.Entities.Assets.Guards public static Task CanMove(MoveAsset command, IAssetQueryService assetQuery, Guid oldParentId) { - Guard.NotNull(command); + Guard.NotNull(command, nameof(command)); return Validate.It(() => "Cannot move asset.", async e => { @@ -62,12 +62,12 @@ namespace Squidex.Domain.Apps.Entities.Assets.Guards public static void CanUpdate(UpdateAsset command) { - Guard.NotNull(command); + Guard.NotNull(command, nameof(command)); } public static void CanDelete(DeleteAsset command) { - Guard.NotNull(command); + Guard.NotNull(command, nameof(command)); } private static async Task CheckPathAsync(Guid parentId, IAssetQueryService assetQuery, AddValidation e) diff --git a/backend/src/Squidex.Domain.Apps.Entities/Assets/Guards/GuardAssetFolder.cs b/backend/src/Squidex.Domain.Apps.Entities/Assets/Guards/GuardAssetFolder.cs index 4e2b270cd..b615d065b 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Assets/Guards/GuardAssetFolder.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Assets/Guards/GuardAssetFolder.cs @@ -17,7 +17,7 @@ namespace Squidex.Domain.Apps.Entities.Assets.Guards { public static Task CanCreate(CreateAssetFolder command, IAssetQueryService assetQuery) { - Guard.NotNull(command); + Guard.NotNull(command, nameof(command)); return Validate.It(() => "Cannot upload asset.", async e => { @@ -32,7 +32,7 @@ namespace Squidex.Domain.Apps.Entities.Assets.Guards public static void CanRename(RenameAssetFolder command) { - Guard.NotNull(command); + Guard.NotNull(command, nameof(command)); Validate.It(() => "Cannot rename asset.", e => { @@ -45,7 +45,7 @@ namespace Squidex.Domain.Apps.Entities.Assets.Guards public static Task CanMove(MoveAssetFolder command, IAssetQueryService assetQuery, Guid id, Guid oldParentId) { - Guard.NotNull(command); + Guard.NotNull(command, nameof(command)); return Validate.It(() => "Cannot move asset.", async e => { @@ -58,7 +58,7 @@ namespace Squidex.Domain.Apps.Entities.Assets.Guards public static void CanDelete(DeleteAssetFolder command) { - Guard.NotNull(command); + Guard.NotNull(command, nameof(command)); } private static async Task CheckPathAsync(Guid parentId, IAssetQueryService assetQuery, Guid id, AddValidation e) diff --git a/backend/src/Squidex.Domain.Apps.Entities/Assets/ImageAssetMetadataSource.cs b/backend/src/Squidex.Domain.Apps.Entities/Assets/ImageAssetMetadataSource.cs index 7c352b535..f1e7549b6 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Assets/ImageAssetMetadataSource.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Assets/ImageAssetMetadataSource.cs @@ -20,7 +20,7 @@ namespace Squidex.Domain.Apps.Entities.Assets public ImageAssetMetadataSource(IAssetThumbnailGenerator assetThumbnailGenerator) { - Guard.NotNull(assetThumbnailGenerator); + Guard.NotNull(assetThumbnailGenerator, nameof(assetThumbnailGenerator)); this.assetThumbnailGenerator = assetThumbnailGenerator; } diff --git a/backend/src/Squidex.Domain.Apps.Entities/Assets/Queries/AssetEnricher.cs b/backend/src/Squidex.Domain.Apps.Entities/Assets/Queries/AssetEnricher.cs index a88529e8f..903554259 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Assets/Queries/AssetEnricher.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Assets/Queries/AssetEnricher.cs @@ -25,9 +25,9 @@ namespace Squidex.Domain.Apps.Entities.Assets.Queries public AssetEnricher(ITagService tagService, IEnumerable assetMetadataSources, IRequestCache requestCache) { - Guard.NotNull(tagService); - Guard.NotNull(assetMetadataSources); - Guard.NotNull(requestCache); + Guard.NotNull(tagService, nameof(tagService)); + Guard.NotNull(assetMetadataSources, nameof(assetMetadataSources)); + Guard.NotNull(requestCache, nameof(requestCache)); this.tagService = tagService; this.assetMetadataSources = assetMetadataSources; @@ -36,8 +36,8 @@ namespace Squidex.Domain.Apps.Entities.Assets.Queries public async Task EnrichAsync(IAssetEntity asset, Context context) { - Guard.NotNull(asset); - Guard.NotNull(context); + Guard.NotNull(asset, nameof(asset)); + Guard.NotNull(context, nameof(context)); var enriched = await EnrichAsync(Enumerable.Repeat(asset, 1), context); @@ -46,8 +46,8 @@ namespace Squidex.Domain.Apps.Entities.Assets.Queries public async Task> EnrichAsync(IEnumerable assets, Context context) { - Guard.NotNull(assets); - Guard.NotNull(context); + Guard.NotNull(assets, nameof(assets)); + Guard.NotNull(context, nameof(context)); using (Profiler.TraceMethod()) { diff --git a/backend/src/Squidex.Domain.Apps.Entities/Assets/Queries/AssetLoader.cs b/backend/src/Squidex.Domain.Apps.Entities/Assets/Queries/AssetLoader.cs index 5265ae1fc..82adbe7db 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Assets/Queries/AssetLoader.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Assets/Queries/AssetLoader.cs @@ -19,7 +19,7 @@ namespace Squidex.Domain.Apps.Entities.Assets.Queries public AssetLoader(IGrainFactory grainFactory) { - Guard.NotNull(grainFactory); + Guard.NotNull(grainFactory, nameof(grainFactory)); this.grainFactory = grainFactory; } diff --git a/backend/src/Squidex.Domain.Apps.Entities/Assets/Queries/AssetQueryParser.cs b/backend/src/Squidex.Domain.Apps.Entities/Assets/Queries/AssetQueryParser.cs index b854253e1..800658466 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Assets/Queries/AssetQueryParser.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Assets/Queries/AssetQueryParser.cs @@ -32,9 +32,9 @@ namespace Squidex.Domain.Apps.Entities.Assets.Queries public AssetQueryParser(IJsonSerializer jsonSerializer, ITagService tagService, IOptions options) { - Guard.NotNull(jsonSerializer); - Guard.NotNull(options); - Guard.NotNull(tagService); + Guard.NotNull(jsonSerializer, nameof(jsonSerializer)); + Guard.NotNull(options, nameof(options)); + Guard.NotNull(tagService, nameof(tagService)); this.jsonSerializer = jsonSerializer; this.options = options.Value; @@ -43,7 +43,7 @@ namespace Squidex.Domain.Apps.Entities.Assets.Queries public virtual ClrQuery ParseQuery(Context context, Q q) { - Guard.NotNull(context); + Guard.NotNull(context, nameof(context)); using (Profiler.TraceMethod()) { diff --git a/backend/src/Squidex.Domain.Apps.Entities/Assets/Queries/AssetQueryService.cs b/backend/src/Squidex.Domain.Apps.Entities/Assets/Queries/AssetQueryService.cs index 09fec1034..77d59a537 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Assets/Queries/AssetQueryService.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Assets/Queries/AssetQueryService.cs @@ -27,10 +27,10 @@ namespace Squidex.Domain.Apps.Entities.Assets.Queries IAssetFolderRepository assetFolderRepository, AssetQueryParser queryParser) { - Guard.NotNull(assetEnricher); - Guard.NotNull(assetRepository); - Guard.NotNull(assetFolderRepository); - Guard.NotNull(queryParser); + Guard.NotNull(assetEnricher, nameof(assetEnricher)); + Guard.NotNull(assetRepository, nameof(assetRepository)); + Guard.NotNull(assetFolderRepository, nameof(assetFolderRepository)); + Guard.NotNull(queryParser, nameof(queryParser)); this.assetEnricher = assetEnricher; this.assetRepository = assetRepository; @@ -81,7 +81,7 @@ namespace Squidex.Domain.Apps.Entities.Assets.Queries public async Task> QueryByHashAsync(Context context, Guid appId, string hash) { - Guard.NotNull(hash); + Guard.NotNull(hash, nameof(hash)); var assets = await assetRepository.QueryByHashAsync(appId, hash); @@ -90,8 +90,8 @@ namespace Squidex.Domain.Apps.Entities.Assets.Queries public async Task> QueryAsync(Context context, Guid? parentId, Q query) { - Guard.NotNull(context); - Guard.NotNull(query); + Guard.NotNull(context, nameof(context)); + Guard.NotNull(query, nameof(query)); IResultList assets; diff --git a/backend/src/Squidex.Domain.Apps.Entities/Assets/Queries/FilterTagTransformer.cs b/backend/src/Squidex.Domain.Apps.Entities/Assets/Queries/FilterTagTransformer.cs index d39af6a13..0ee4380ac 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Assets/Queries/FilterTagTransformer.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Assets/Queries/FilterTagTransformer.cs @@ -27,8 +27,8 @@ namespace Squidex.Domain.Apps.Entities.Assets.Queries public static FilterNode? Transform(FilterNode nodeIn, Guid appId, ITagService tagService) { - Guard.NotNull(nodeIn); - Guard.NotNull(tagService); + Guard.NotNull(nodeIn, nameof(nodeIn)); + Guard.NotNull(tagService, nameof(tagService)); return nodeIn.Accept(new FilterTagTransformer(appId, tagService)); } diff --git a/backend/src/Squidex.Domain.Apps.Entities/Assets/RecursiveDeleter.cs b/backend/src/Squidex.Domain.Apps.Entities/Assets/RecursiveDeleter.cs index 34402d7ad..fbe4d92c6 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Assets/RecursiveDeleter.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Assets/RecursiveDeleter.cs @@ -43,11 +43,11 @@ namespace Squidex.Domain.Apps.Entities.Assets TypeNameRegistry typeNameRegistry, ISemanticLog log) { - Guard.NotNull(commandBus); - Guard.NotNull(assetRepository); - Guard.NotNull(assetFolderRepository); - Guard.NotNull(typeNameRegistry); - Guard.NotNull(log); + Guard.NotNull(commandBus, nameof(commandBus)); + Guard.NotNull(assetRepository, nameof(assetRepository)); + Guard.NotNull(assetFolderRepository, nameof(assetFolderRepository)); + Guard.NotNull(typeNameRegistry, nameof(typeNameRegistry)); + Guard.NotNull(log, nameof(log)); this.commandBus = commandBus; this.assetRepository = assetRepository; diff --git a/backend/src/Squidex.Domain.Apps.Entities/Backup/BackupContext.cs b/backend/src/Squidex.Domain.Apps.Entities/Backup/BackupContext.cs index 1a34b0b63..764892de7 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Backup/BackupContext.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Backup/BackupContext.cs @@ -17,7 +17,7 @@ namespace Squidex.Domain.Apps.Entities.Backup public BackupContext(Guid appId, IUserMapping userMapping, IBackupWriter writer) : base(appId, userMapping) { - Guard.NotNull(writer); + Guard.NotNull(writer, nameof(writer)); Writer = writer; } diff --git a/backend/src/Squidex.Domain.Apps.Entities/Backup/BackupContextBase.cs b/backend/src/Squidex.Domain.Apps.Entities/Backup/BackupContextBase.cs index f520719b7..67dee0ea5 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Backup/BackupContextBase.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Backup/BackupContextBase.cs @@ -23,7 +23,7 @@ namespace Squidex.Domain.Apps.Entities.Backup protected BackupContextBase(Guid appId, IUserMapping userMapping) { - Guard.NotNull(userMapping); + Guard.NotNull(userMapping, nameof(userMapping)); AppId = appId; diff --git a/backend/src/Squidex.Domain.Apps.Entities/Backup/BackupGrain.cs b/backend/src/Squidex.Domain.Apps.Entities/Backup/BackupGrain.cs index 10d494612..97567f106 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Backup/BackupGrain.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Backup/BackupGrain.cs @@ -52,15 +52,15 @@ namespace Squidex.Domain.Apps.Entities.Backup IUserResolver userResolver, ISemanticLog log) { - Guard.NotNull(backupArchiveLocation); - Guard.NotNull(backupArchiveStore); - Guard.NotNull(clock); - Guard.NotNull(eventDataFormatter); - Guard.NotNull(eventStore); - Guard.NotNull(serviceProvider); - Guard.NotNull(state); - Guard.NotNull(userResolver); - Guard.NotNull(log); + Guard.NotNull(backupArchiveLocation, nameof(backupArchiveLocation)); + Guard.NotNull(backupArchiveStore, nameof(backupArchiveStore)); + Guard.NotNull(clock, nameof(clock)); + Guard.NotNull(eventDataFormatter, nameof(eventDataFormatter)); + Guard.NotNull(eventStore, nameof(eventStore)); + Guard.NotNull(serviceProvider, nameof(serviceProvider)); + Guard.NotNull(state, nameof(state)); + Guard.NotNull(userResolver, nameof(userResolver)); + Guard.NotNull(log, nameof(log)); this.backupArchiveLocation = backupArchiveLocation; this.backupArchiveStore = backupArchiveStore; diff --git a/backend/src/Squidex.Domain.Apps.Entities/Backup/BackupReader.cs b/backend/src/Squidex.Domain.Apps.Entities/Backup/BackupReader.cs index e0c03e9fa..56460d1e6 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Backup/BackupReader.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Backup/BackupReader.cs @@ -42,7 +42,7 @@ namespace Squidex.Domain.Apps.Entities.Backup public BackupReader(IJsonSerializer serializer, Stream stream) { - Guard.NotNull(serializer); + Guard.NotNull(serializer, nameof(serializer)); this.serializer = serializer; @@ -64,7 +64,7 @@ namespace Squidex.Domain.Apps.Entities.Backup public Task ReadJsonAttachmentAsync(string name) { - Guard.NotNullOrEmpty(name); + Guard.NotNullOrEmpty(name, nameof(name)); var attachmentEntry = archive.GetEntry(ArchiveHelper.GetAttachmentPath(name)); @@ -87,8 +87,8 @@ namespace Squidex.Domain.Apps.Entities.Backup public async Task ReadBlobAsync(string name, Func handler) { - Guard.NotNullOrEmpty(name); - Guard.NotNull(handler); + Guard.NotNullOrEmpty(name, nameof(name)); + Guard.NotNull(handler, nameof(handler)); var attachmentEntry = archive.GetEntry(ArchiveHelper.GetAttachmentPath(name)); @@ -107,9 +107,9 @@ namespace Squidex.Domain.Apps.Entities.Backup public async Task ReadEventsAsync(IStreamNameResolver streamNameResolver, IEventDataFormatter formatter, Func<(string Stream, Envelope Event), Task> handler) { - Guard.NotNull(handler); - Guard.NotNull(formatter); - Guard.NotNull(streamNameResolver); + Guard.NotNull(handler, nameof(handler)); + Guard.NotNull(formatter, nameof(formatter)); + Guard.NotNull(streamNameResolver, nameof(streamNameResolver)); while (true) { diff --git a/backend/src/Squidex.Domain.Apps.Entities/Backup/BackupService.cs b/backend/src/Squidex.Domain.Apps.Entities/Backup/BackupService.cs index 621e4698e..42a80bdc9 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Backup/BackupService.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Backup/BackupService.cs @@ -20,7 +20,7 @@ namespace Squidex.Domain.Apps.Entities.Backup public BackupService(IGrainFactory grainFactory) { - Guard.NotNull(grainFactory); + Guard.NotNull(grainFactory, nameof(grainFactory)); this.grainFactory = grainFactory; } diff --git a/backend/src/Squidex.Domain.Apps.Entities/Backup/BackupWriter.cs b/backend/src/Squidex.Domain.Apps.Entities/Backup/BackupWriter.cs index 2067137a1..a44342981 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Backup/BackupWriter.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Backup/BackupWriter.cs @@ -37,7 +37,7 @@ namespace Squidex.Domain.Apps.Entities.Backup public BackupWriter(IJsonSerializer serializer, Stream stream, bool keepOpen = false, BackupVersion version = BackupVersion.V2) { - Guard.NotNull(serializer); + Guard.NotNull(serializer, nameof(serializer)); this.serializer = serializer; @@ -59,7 +59,7 @@ namespace Squidex.Domain.Apps.Entities.Backup public Task WriteJsonAsync(string name, object value) { - Guard.NotNullOrEmpty(name); + Guard.NotNullOrEmpty(name, nameof(name)); var attachmentEntry = archive.CreateEntry(ArchiveHelper.GetAttachmentPath(name)); @@ -75,8 +75,8 @@ namespace Squidex.Domain.Apps.Entities.Backup public async Task WriteBlobAsync(string name, Func handler) { - Guard.NotNullOrEmpty(name); - Guard.NotNull(handler); + Guard.NotNullOrEmpty(name, nameof(name)); + Guard.NotNull(handler, nameof(handler)); var attachmentEntry = archive.CreateEntry(ArchiveHelper.GetAttachmentPath(name)); @@ -90,7 +90,7 @@ namespace Squidex.Domain.Apps.Entities.Backup public void WriteEvent(StoredEvent storedEvent) { - Guard.NotNull(storedEvent); + Guard.NotNull(storedEvent, nameof(storedEvent)); var eventEntry = archive.CreateEntry(ArchiveHelper.GetEventPath(writtenEvents)); diff --git a/backend/src/Squidex.Domain.Apps.Entities/Backup/DefaultBackupArchiveStore.cs b/backend/src/Squidex.Domain.Apps.Entities/Backup/DefaultBackupArchiveStore.cs index 301dfa7c2..9a03e48a7 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Backup/DefaultBackupArchiveStore.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Backup/DefaultBackupArchiveStore.cs @@ -20,7 +20,7 @@ namespace Squidex.Domain.Apps.Entities.Backup public DefaultBackupArchiveStore(IAssetStore assetStore) { - Guard.NotNull(assetStore); + Guard.NotNull(assetStore, nameof(assetStore)); this.assetStore = assetStore; } diff --git a/backend/src/Squidex.Domain.Apps.Entities/Backup/RestoreContext.cs b/backend/src/Squidex.Domain.Apps.Entities/Backup/RestoreContext.cs index a571fa957..e122069b5 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Backup/RestoreContext.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Backup/RestoreContext.cs @@ -17,7 +17,7 @@ namespace Squidex.Domain.Apps.Entities.Backup public RestoreContext(Guid appId, IUserMapping userMapping, IBackupReader reader) : base(appId, userMapping) { - Guard.NotNull(reader); + Guard.NotNull(reader, nameof(reader)); Reader = reader; } diff --git a/backend/src/Squidex.Domain.Apps.Entities/Backup/RestoreGrain.cs b/backend/src/Squidex.Domain.Apps.Entities/Backup/RestoreGrain.cs index f40e9e813..297e051e1 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Backup/RestoreGrain.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Backup/RestoreGrain.cs @@ -58,16 +58,16 @@ namespace Squidex.Domain.Apps.Entities.Backup IUserResolver userResolver, ISemanticLog log) { - Guard.NotNull(backupArchiveLocation); - Guard.NotNull(clock); - Guard.NotNull(commandBus); - Guard.NotNull(eventDataFormatter); - Guard.NotNull(eventStore); - Guard.NotNull(serviceProvider); - Guard.NotNull(state); - Guard.NotNull(streamNameResolver); - Guard.NotNull(userResolver); - Guard.NotNull(log); + Guard.NotNull(backupArchiveLocation, nameof(backupArchiveLocation)); + Guard.NotNull(clock, nameof(clock)); + Guard.NotNull(commandBus, nameof(commandBus)); + Guard.NotNull(eventDataFormatter, nameof(eventDataFormatter)); + Guard.NotNull(eventStore, nameof(eventStore)); + Guard.NotNull(serviceProvider, nameof(serviceProvider)); + Guard.NotNull(state, nameof(state)); + Guard.NotNull(streamNameResolver, nameof(streamNameResolver)); + Guard.NotNull(userResolver, nameof(userResolver)); + Guard.NotNull(log, nameof(log)); this.backupArchiveLocation = backupArchiveLocation; this.clock = clock; @@ -102,12 +102,12 @@ namespace Squidex.Domain.Apps.Entities.Backup public async Task RestoreAsync(Uri url, RefToken actor, string? newAppName) { - Guard.NotNull(url); - Guard.NotNull(actor); + Guard.NotNull(url, nameof(url)); + Guard.NotNull(actor, nameof(actor)); if (!string.IsNullOrWhiteSpace(newAppName)) { - Guard.ValidSlug(newAppName); + Guard.ValidSlug(newAppName, nameof(newAppName)); } if (CurrentJob?.Status == JobStatus.Started) diff --git a/backend/src/Squidex.Domain.Apps.Entities/Backup/TempFolderBackupArchiveLocation.cs b/backend/src/Squidex.Domain.Apps.Entities/Backup/TempFolderBackupArchiveLocation.cs index 8decd9935..0c883a167 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Backup/TempFolderBackupArchiveLocation.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Backup/TempFolderBackupArchiveLocation.cs @@ -22,7 +22,7 @@ namespace Squidex.Domain.Apps.Entities.Backup public TempFolderBackupArchiveLocation(IJsonSerializer jsonSerializer) { - Guard.NotNull(jsonSerializer); + Guard.NotNull(jsonSerializer, nameof(jsonSerializer)); this.jsonSerializer = jsonSerializer; } diff --git a/backend/src/Squidex.Domain.Apps.Entities/Backup/UserMapping.cs b/backend/src/Squidex.Domain.Apps.Entities/Backup/UserMapping.cs index c0579e27f..38bef8228 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Backup/UserMapping.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Backup/UserMapping.cs @@ -26,14 +26,14 @@ namespace Squidex.Domain.Apps.Entities.Backup public UserMapping(RefToken initiator) { - Guard.NotNull(initiator); + Guard.NotNull(initiator, nameof(initiator)); this.initiator = initiator; } public void Backup(RefToken token) { - Guard.NotNull(token); + Guard.NotNull(token, nameof(token)); if (!token.IsSubject) { @@ -45,7 +45,7 @@ namespace Squidex.Domain.Apps.Entities.Backup public void Backup(string userId) { - Guard.NotNullOrEmpty(userId); + Guard.NotNullOrEmpty(userId, nameof(userId)); if (!userMap.ContainsKey(userId)) { @@ -55,8 +55,8 @@ namespace Squidex.Domain.Apps.Entities.Backup public async Task StoreAsync(IBackupWriter writer, IUserResolver userResolver) { - Guard.NotNull(writer); - Guard.NotNull(userResolver); + Guard.NotNull(writer, nameof(writer)); + Guard.NotNull(userResolver, nameof(userResolver)); var users = await userResolver.QueryManyAsync(userMap.Keys.ToArray()); @@ -67,8 +67,8 @@ namespace Squidex.Domain.Apps.Entities.Backup public async Task RestoreAsync(IBackupReader reader, IUserResolver userResolver) { - Guard.NotNull(reader); - Guard.NotNull(userResolver); + Guard.NotNull(reader, nameof(reader)); + Guard.NotNull(userResolver, nameof(userResolver)); var json = await reader.ReadJsonAttachmentAsync>(UsersFile); @@ -85,7 +85,7 @@ namespace Squidex.Domain.Apps.Entities.Backup public bool TryMap(string userId, out RefToken result) { - Guard.NotNullOrEmpty(userId); + Guard.NotNullOrEmpty(userId, nameof(userId)); if (userMap.TryGetValue(userId, out var mapped)) { @@ -99,7 +99,7 @@ namespace Squidex.Domain.Apps.Entities.Backup public bool TryMap(RefToken token, out RefToken result) { - Guard.NotNull(token); + Guard.NotNull(token, nameof(token)); if (token.IsClient) { diff --git a/backend/src/Squidex.Domain.Apps.Entities/Comments/CommentTriggerHandler.cs b/backend/src/Squidex.Domain.Apps.Entities/Comments/CommentTriggerHandler.cs index 7ffcb2c8c..b9c80b8e4 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Comments/CommentTriggerHandler.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Comments/CommentTriggerHandler.cs @@ -28,8 +28,8 @@ namespace Squidex.Domain.Apps.Entities.Comments public CommentTriggerHandler(IScriptEngine scriptEngine, IUserResolver userResolver) { - Guard.NotNull(scriptEngine); - Guard.NotNull(userResolver); + Guard.NotNull(scriptEngine, nameof(scriptEngine)); + Guard.NotNull(userResolver, nameof(userResolver)); this.scriptEngine = scriptEngine; diff --git a/backend/src/Squidex.Domain.Apps.Entities/Comments/CommentsCommandMiddleware.cs b/backend/src/Squidex.Domain.Apps.Entities/Comments/CommentsCommandMiddleware.cs index b86b77218..6ce58e3ec 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Comments/CommentsCommandMiddleware.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Comments/CommentsCommandMiddleware.cs @@ -29,8 +29,8 @@ namespace Squidex.Domain.Apps.Entities.Comments public CommentsCommandMiddleware(IGrainFactory grainFactory, IUserResolver userResolver) { - Guard.NotNull(grainFactory); - Guard.NotNull(userResolver); + Guard.NotNull(grainFactory, nameof(grainFactory)); + Guard.NotNull(userResolver, nameof(userResolver)); this.grainFactory = grainFactory; diff --git a/backend/src/Squidex.Domain.Apps.Entities/Comments/CommentsGrain.cs b/backend/src/Squidex.Domain.Apps.Entities/Comments/CommentsGrain.cs index 518ad0b38..c06f79f56 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Comments/CommentsGrain.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Comments/CommentsGrain.cs @@ -36,8 +36,8 @@ namespace Squidex.Domain.Apps.Entities.Comments public CommentsGrain(IEventStore eventStore, IEventDataFormatter eventDataFormatter) { - Guard.NotNull(eventStore); - Guard.NotNull(eventDataFormatter); + Guard.NotNull(eventStore, nameof(eventStore)); + Guard.NotNull(eventDataFormatter, nameof(eventDataFormatter)); this.eventStore = eventStore; this.eventDataFormatter = eventDataFormatter; @@ -107,8 +107,8 @@ namespace Squidex.Domain.Apps.Entities.Comments private async Task Upsert(TCommand command, Func handler) where TCommand : CommentsCommand { - Guard.NotNull(command); - Guard.NotNull(handler); + Guard.NotNull(command, nameof(command)); + Guard.NotNull(handler, nameof(handler)); if (command.ExpectedVersion > EtagVersion.Any && command.ExpectedVersion != Version) { diff --git a/backend/src/Squidex.Domain.Apps.Entities/Comments/Guards/GuardComments.cs b/backend/src/Squidex.Domain.Apps.Entities/Comments/Guards/GuardComments.cs index 0524b6446..ddde50c91 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Comments/Guards/GuardComments.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Comments/Guards/GuardComments.cs @@ -19,7 +19,7 @@ namespace Squidex.Domain.Apps.Entities.Comments.Guards { public static void CanCreate(CreateComment command) { - Guard.NotNull(command); + Guard.NotNull(command, nameof(command)); Validate.It(() => "Cannot create comment.", e => { @@ -32,7 +32,7 @@ namespace Squidex.Domain.Apps.Entities.Comments.Guards public static void CanUpdate(string commentsId, List> events, UpdateComment command) { - Guard.NotNull(command); + Guard.NotNull(command, nameof(command)); var comment = FindComment(events, command.CommentId); @@ -52,7 +52,7 @@ namespace Squidex.Domain.Apps.Entities.Comments.Guards public static void CanDelete(string commentsId, List> events, DeleteComment command) { - Guard.NotNull(command); + Guard.NotNull(command, nameof(command)); var comment = FindComment(events, command.CommentId); diff --git a/backend/src/Squidex.Domain.Apps.Entities/Contents/BackupContents.cs b/backend/src/Squidex.Domain.Apps.Entities/Contents/BackupContents.cs index 4cc0d228b..6542477ea 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Contents/BackupContents.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Contents/BackupContents.cs @@ -28,7 +28,7 @@ namespace Squidex.Domain.Apps.Entities.Contents public BackupContents(Rebuilder rebuilder) { - Guard.NotNull(rebuilder); + Guard.NotNull(rebuilder, nameof(rebuilder)); this.rebuilder = rebuilder; } diff --git a/backend/src/Squidex.Domain.Apps.Entities/Contents/BulkUpdateCommandMiddleware.cs b/backend/src/Squidex.Domain.Apps.Entities/Contents/BulkUpdateCommandMiddleware.cs index bfe482ea0..11d5b0a3c 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Contents/BulkUpdateCommandMiddleware.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Contents/BulkUpdateCommandMiddleware.cs @@ -25,9 +25,9 @@ namespace Squidex.Domain.Apps.Entities.Contents public BulkUpdateCommandMiddleware(IServiceProvider serviceProvider, IContentQueryService contentQuery, IContextProvider contextProvider) { - Guard.NotNull(serviceProvider); - Guard.NotNull(contentQuery); - Guard.NotNull(contextProvider); + Guard.NotNull(serviceProvider, nameof(serviceProvider)); + Guard.NotNull(contentQuery, nameof(contentQuery)); + Guard.NotNull(contextProvider, nameof(contextProvider)); this.serviceProvider = serviceProvider; this.contentQuery = contentQuery; diff --git a/backend/src/Squidex.Domain.Apps.Entities/Contents/ContentChangedTriggerHandler.cs b/backend/src/Squidex.Domain.Apps.Entities/Contents/ContentChangedTriggerHandler.cs index 7667fbb93..f1bc57915 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Contents/ContentChangedTriggerHandler.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Contents/ContentChangedTriggerHandler.cs @@ -26,8 +26,8 @@ namespace Squidex.Domain.Apps.Entities.Contents public ContentChangedTriggerHandler(IScriptEngine scriptEngine, IContentLoader contentLoader) { - Guard.NotNull(scriptEngine); - Guard.NotNull(contentLoader); + Guard.NotNull(scriptEngine, nameof(scriptEngine)); + Guard.NotNull(contentLoader, nameof(contentLoader)); this.scriptEngine = scriptEngine; diff --git a/backend/src/Squidex.Domain.Apps.Entities/Contents/ContentCommandMiddleware.cs b/backend/src/Squidex.Domain.Apps.Entities/Contents/ContentCommandMiddleware.cs index 736b3ebcc..d5d343745 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Contents/ContentCommandMiddleware.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Contents/ContentCommandMiddleware.cs @@ -22,8 +22,8 @@ namespace Squidex.Domain.Apps.Entities.Contents public ContentCommandMiddleware(IGrainFactory grainFactory, IContentEnricher contentEnricher, IContextProvider contextProvider) : base(grainFactory) { - Guard.NotNull(contentEnricher); - Guard.NotNull(contextProvider); + Guard.NotNull(contentEnricher, nameof(contentEnricher)); + Guard.NotNull(contextProvider, nameof(contextProvider)); this.contentEnricher = contentEnricher; this.contextProvider = contextProvider; diff --git a/backend/src/Squidex.Domain.Apps.Entities/Contents/ContentDomainObject.cs b/backend/src/Squidex.Domain.Apps.Entities/Contents/ContentDomainObject.cs index 712d6c315..071837883 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Contents/ContentDomainObject.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Contents/ContentDomainObject.cs @@ -32,8 +32,8 @@ namespace Squidex.Domain.Apps.Entities.Contents public ContentDomainObject(IStore store, IContentWorkflow contentWorkflow, ContentOperationContext context, ISemanticLog log) : base(store, log) { - Guard.NotNull(context); - Guard.NotNull(contentWorkflow); + Guard.NotNull(context, nameof(context)); + Guard.NotNull(contentWorkflow, nameof(contentWorkflow)); this.contentWorkflow = contentWorkflow; this.context = context; diff --git a/backend/src/Squidex.Domain.Apps.Entities/Contents/ContentSchedulerGrain.cs b/backend/src/Squidex.Domain.Apps.Entities/Contents/ContentSchedulerGrain.cs index 583828c53..7184a4b05 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Contents/ContentSchedulerGrain.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Contents/ContentSchedulerGrain.cs @@ -33,10 +33,10 @@ namespace Squidex.Domain.Apps.Entities.Contents IClock clock, ISemanticLog log) { - Guard.NotNull(contentRepository); - Guard.NotNull(commandBus); - Guard.NotNull(clock); - Guard.NotNull(log); + Guard.NotNull(contentRepository, nameof(contentRepository)); + Guard.NotNull(commandBus, nameof(commandBus)); + Guard.NotNull(clock, nameof(clock)); + Guard.NotNull(log, nameof(log)); this.clock = clock; diff --git a/backend/src/Squidex.Domain.Apps.Entities/Contents/ContentsSearchSource.cs b/backend/src/Squidex.Domain.Apps.Entities/Contents/ContentsSearchSource.cs index 3d019f8ac..77f5a415b 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Contents/ContentsSearchSource.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Contents/ContentsSearchSource.cs @@ -35,10 +35,10 @@ namespace Squidex.Domain.Apps.Entities.Contents ITextIndex contentTextIndexer, IUrlGenerator urlGenerator) { - Guard.NotNull(appProvider); - Guard.NotNull(contentQuery); - Guard.NotNull(contentTextIndexer); - Guard.NotNull(urlGenerator); + Guard.NotNull(appProvider, nameof(appProvider)); + Guard.NotNull(contentQuery, nameof(contentQuery)); + Guard.NotNull(contentTextIndexer, nameof(contentTextIndexer)); + Guard.NotNull(urlGenerator, nameof(urlGenerator)); this.appProvider = appProvider; this.contentQuery = contentQuery; diff --git a/backend/src/Squidex.Domain.Apps.Entities/Contents/Counter/CounterGrain.cs b/backend/src/Squidex.Domain.Apps.Entities/Contents/Counter/CounterGrain.cs index 586de51ed..4eea97aba 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Contents/Counter/CounterGrain.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Contents/Counter/CounterGrain.cs @@ -25,7 +25,7 @@ namespace Squidex.Domain.Apps.Entities.Contents.Counter public CounterGrain(IGrainState state) { - Guard.NotNull(state); + Guard.NotNull(state, nameof(state)); this.state = state; } diff --git a/backend/src/Squidex.Domain.Apps.Entities/Contents/Counter/CounterScriptExtension.cs b/backend/src/Squidex.Domain.Apps.Entities/Contents/Counter/CounterScriptExtension.cs index cc0ac0c21..b9b5ff175 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Contents/Counter/CounterScriptExtension.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Contents/Counter/CounterScriptExtension.cs @@ -19,7 +19,7 @@ namespace Squidex.Domain.Apps.Entities.Contents.Counter public CounterScriptExtension(IGrainFactory grainFactory) { - Guard.NotNull(grainFactory); + Guard.NotNull(grainFactory, nameof(grainFactory)); this.grainFactory = grainFactory; } diff --git a/backend/src/Squidex.Domain.Apps.Entities/Contents/DefaultWorkflowsValidator.cs b/backend/src/Squidex.Domain.Apps.Entities/Contents/DefaultWorkflowsValidator.cs index bc3d4344a..75ddd704b 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Contents/DefaultWorkflowsValidator.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Contents/DefaultWorkflowsValidator.cs @@ -20,14 +20,14 @@ namespace Squidex.Domain.Apps.Entities.Contents public DefaultWorkflowsValidator(IAppProvider appProvider) { - Guard.NotNull(appProvider); + Guard.NotNull(appProvider, nameof(appProvider)); this.appProvider = appProvider; } public async Task> ValidateAsync(Guid appId, Workflows workflows) { - Guard.NotNull(workflows); + Guard.NotNull(workflows, nameof(workflows)); var errors = new List(); diff --git a/backend/src/Squidex.Domain.Apps.Entities/Contents/DynamicContentWorkflow.cs b/backend/src/Squidex.Domain.Apps.Entities/Contents/DynamicContentWorkflow.cs index 73e282435..6a2db1cba 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Contents/DynamicContentWorkflow.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Contents/DynamicContentWorkflow.cs @@ -24,8 +24,8 @@ namespace Squidex.Domain.Apps.Entities.Contents public DynamicContentWorkflow(IScriptEngine scriptEngine, IAppProvider appProvider) { - Guard.NotNull(scriptEngine); - Guard.NotNull(appProvider); + Guard.NotNull(scriptEngine, nameof(scriptEngine)); + Guard.NotNull(appProvider, nameof(appProvider)); this.scriptEngine = scriptEngine; diff --git a/backend/src/Squidex.Domain.Apps.Entities/Contents/GraphQL/CachingGraphQLService.cs b/backend/src/Squidex.Domain.Apps.Entities/Contents/GraphQL/CachingGraphQLService.cs index 6b1b7ca89..6437d3fb5 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Contents/GraphQL/CachingGraphQLService.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Contents/GraphQL/CachingGraphQLService.cs @@ -27,15 +27,15 @@ namespace Squidex.Domain.Apps.Entities.Contents.GraphQL public CachingGraphQLService(IMemoryCache cache, IDependencyResolver resolver) : base(cache) { - Guard.NotNull(resolver); + Guard.NotNull(resolver, nameof(resolver)); this.resolver = resolver; } public async Task<(bool HasError, object Response)> QueryAsync(Context context, params GraphQLQuery[] queries) { - Guard.NotNull(context); - Guard.NotNull(queries); + Guard.NotNull(context, nameof(context)); + Guard.NotNull(queries, nameof(queries)); var model = await GetModelAsync(context.App); @@ -48,8 +48,8 @@ namespace Squidex.Domain.Apps.Entities.Contents.GraphQL public async Task<(bool HasError, object Response)> QueryAsync(Context context, GraphQLQuery query) { - Guard.NotNull(context); - Guard.NotNull(query); + Guard.NotNull(context, nameof(context)); + Guard.NotNull(query, nameof(query)); var model = await GetModelAsync(context.App); diff --git a/backend/src/Squidex.Domain.Apps.Entities/Contents/GraphQL/GraphQLModel.cs b/backend/src/Squidex.Domain.Apps.Entities/Contents/GraphQL/GraphQLModel.cs index 64cb1d7bc..8bdfc9219 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Contents/GraphQL/GraphQLModel.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Contents/GraphQL/GraphQLModel.cs @@ -163,7 +163,7 @@ namespace Squidex.Domain.Apps.Entities.Contents.GraphQL public async Task<(object Data, object[]? Errors)> ExecuteAsync(GraphQLExecutionContext context, GraphQLQuery query) { - Guard.NotNull(context); + Guard.NotNull(context, nameof(context)); var result = await new DocumentExecuter().ExecuteAsync(execution => { diff --git a/backend/src/Squidex.Domain.Apps.Entities/Contents/GraphQL/Middlewares.cs b/backend/src/Squidex.Domain.Apps.Entities/Contents/GraphQL/Middlewares.cs index 86bd5e74f..03adccccc 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Contents/GraphQL/Middlewares.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Contents/GraphQL/Middlewares.cs @@ -17,7 +17,7 @@ namespace Squidex.Domain.Apps.Entities.Contents.GraphQL { public static Func Logging(ISemanticLog log) { - Guard.NotNull(log); + Guard.NotNull(log, nameof(log)); return next => { diff --git a/backend/src/Squidex.Domain.Apps.Entities/Contents/Guards/GuardContent.cs b/backend/src/Squidex.Domain.Apps.Entities/Contents/Guards/GuardContent.cs index b44872c2f..9388e7165 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Contents/Guards/GuardContent.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Contents/Guards/GuardContent.cs @@ -21,7 +21,7 @@ namespace Squidex.Domain.Apps.Entities.Contents.Guards { public static async Task CanCreate(ISchemaEntity schema, IContentWorkflow contentWorkflow, CreateContent command) { - Guard.NotNull(command); + Guard.NotNull(command, nameof(command)); if (schema.SchemaDef.IsSingleton && command.ContentId != schema.Id) { @@ -41,7 +41,7 @@ namespace Squidex.Domain.Apps.Entities.Contents.Guards public static async Task CanUpdate(ContentState content, IContentWorkflow contentWorkflow, UpdateContent command) { - Guard.NotNull(command); + Guard.NotNull(command, nameof(command)); Validate.It(() => "Cannot update content.", e => { @@ -53,7 +53,7 @@ namespace Squidex.Domain.Apps.Entities.Contents.Guards public static async Task CanPatch(ContentState content, IContentWorkflow contentWorkflow, PatchContent command) { - Guard.NotNull(command); + Guard.NotNull(command, nameof(command)); Validate.It(() => "Cannot patch content.", e => { @@ -65,7 +65,7 @@ namespace Squidex.Domain.Apps.Entities.Contents.Guards public static void CanDeleteDraft(DeleteContentDraft command, ContentState content) { - Guard.NotNull(command); + Guard.NotNull(command, nameof(command)); if (content.NewStatus == null) { @@ -75,7 +75,7 @@ namespace Squidex.Domain.Apps.Entities.Contents.Guards public static void CanCreateDraft(CreateContentDraft command, ContentState content) { - Guard.NotNull(command); + Guard.NotNull(command, nameof(command)); if (content.Status != Status.Published) { @@ -85,7 +85,7 @@ namespace Squidex.Domain.Apps.Entities.Contents.Guards public static Task CanChangeStatus(ISchemaEntity schema, ContentState content, IContentWorkflow contentWorkflow, ChangeContentStatus command) { - Guard.NotNull(command); + Guard.NotNull(command, nameof(command)); if (schema.SchemaDef.IsSingleton) { @@ -113,7 +113,7 @@ namespace Squidex.Domain.Apps.Entities.Contents.Guards public static void CanDelete(ISchemaEntity schema, DeleteContent command) { - Guard.NotNull(command); + Guard.NotNull(command, nameof(command)); if (schema.SchemaDef.IsSingleton) { diff --git a/backend/src/Squidex.Domain.Apps.Entities/Contents/Queries/ContentEnricher.cs b/backend/src/Squidex.Domain.Apps.Entities/Contents/Queries/ContentEnricher.cs index 5b09a992b..925cdc1b2 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Contents/Queries/ContentEnricher.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Contents/Queries/ContentEnricher.cs @@ -28,8 +28,8 @@ namespace Squidex.Domain.Apps.Entities.Contents.Queries public ContentEnricher(IEnumerable steps, Lazy contentQuery) { - Guard.NotNull(steps); - Guard.NotNull(contentQuery); + Guard.NotNull(steps, nameof(steps)); + Guard.NotNull(contentQuery, nameof(contentQuery)); this.steps = steps; @@ -38,7 +38,7 @@ namespace Squidex.Domain.Apps.Entities.Contents.Queries public async Task EnrichAsync(IContentEntity content, bool cloneData, Context context) { - Guard.NotNull(content); + Guard.NotNull(content, nameof(content)); var enriched = await EnrichInternalAsync(Enumerable.Repeat(content, 1), cloneData, context); @@ -47,8 +47,8 @@ namespace Squidex.Domain.Apps.Entities.Contents.Queries public Task> EnrichAsync(IEnumerable contents, Context context) { - Guard.NotNull(contents); - Guard.NotNull(context); + Guard.NotNull(contents, nameof(contents)); + Guard.NotNull(context, nameof(context)); return EnrichInternalAsync(contents, false, context); } diff --git a/backend/src/Squidex.Domain.Apps.Entities/Contents/Queries/ContentLoader.cs b/backend/src/Squidex.Domain.Apps.Entities/Contents/Queries/ContentLoader.cs index 47ff85b87..5abb7f687 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Contents/Queries/ContentLoader.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Contents/Queries/ContentLoader.cs @@ -19,7 +19,7 @@ namespace Squidex.Domain.Apps.Entities.Contents.Queries public ContentLoader(IGrainFactory grainFactory) { - Guard.NotNull(grainFactory); + Guard.NotNull(grainFactory, nameof(grainFactory)); this.grainFactory = grainFactory; } diff --git a/backend/src/Squidex.Domain.Apps.Entities/Contents/Queries/ContentQueryParser.cs b/backend/src/Squidex.Domain.Apps.Entities/Contents/Queries/ContentQueryParser.cs index 2b4bff6a8..a6c486358 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Contents/Queries/ContentQueryParser.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Contents/Queries/ContentQueryParser.cs @@ -45,8 +45,8 @@ namespace Squidex.Domain.Apps.Entities.Contents.Queries public virtual ClrQuery ParseQuery(Context context, ISchemaEntity schema, Q q) { - Guard.NotNull(context); - Guard.NotNull(schema); + Guard.NotNull(context, nameof(context)); + Guard.NotNull(schema, nameof(schema)); using (Profiler.TraceMethod()) { diff --git a/backend/src/Squidex.Domain.Apps.Entities/Contents/Queries/ContentQueryService.cs b/backend/src/Squidex.Domain.Apps.Entities/Contents/Queries/ContentQueryService.cs index 938b97d6b..532a2f6c5 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Contents/Queries/ContentQueryService.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Contents/Queries/ContentQueryService.cs @@ -36,11 +36,11 @@ namespace Squidex.Domain.Apps.Entities.Contents.Queries IContentLoader contentVersionLoader, ContentQueryParser queryParser) { - Guard.NotNull(appProvider); - Guard.NotNull(contentEnricher); - Guard.NotNull(contentRepository); - Guard.NotNull(contentVersionLoader); - Guard.NotNull(queryParser); + Guard.NotNull(appProvider, nameof(appProvider)); + Guard.NotNull(contentEnricher, nameof(contentEnricher)); + Guard.NotNull(contentRepository, nameof(contentRepository)); + Guard.NotNull(contentVersionLoader, nameof(contentVersionLoader)); + Guard.NotNull(queryParser, nameof(queryParser)); this.appProvider = appProvider; this.contentEnricher = contentEnricher; @@ -52,7 +52,7 @@ namespace Squidex.Domain.Apps.Entities.Contents.Queries public async Task FindContentAsync(Context context, string schemaIdOrName, Guid id, long version = -1) { - Guard.NotNull(context); + Guard.NotNull(context, nameof(context)); var schema = await GetSchemaOrThrowAsync(context, schemaIdOrName); @@ -82,7 +82,7 @@ namespace Squidex.Domain.Apps.Entities.Contents.Queries public async Task> QueryAsync(Context context, string schemaIdOrName, Q query) { - Guard.NotNull(context); + Guard.NotNull(context, nameof(context)); var schema = await GetSchemaOrThrowAsync(context, schemaIdOrName); @@ -107,7 +107,7 @@ namespace Squidex.Domain.Apps.Entities.Contents.Queries public async Task> QueryAsync(Context context, IReadOnlyList ids) { - Guard.NotNull(context); + Guard.NotNull(context, nameof(context)); using (Profiler.TraceMethod()) { diff --git a/backend/src/Squidex.Domain.Apps.Entities/Contents/Queries/FilterTagTransformer.cs b/backend/src/Squidex.Domain.Apps.Entities/Contents/Queries/FilterTagTransformer.cs index f5cd77bf4..21cc88623 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Contents/Queries/FilterTagTransformer.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Contents/Queries/FilterTagTransformer.cs @@ -31,9 +31,9 @@ namespace Squidex.Domain.Apps.Entities.Contents.Queries public static FilterNode? Transform(FilterNode nodeIn, Guid appId, ISchemaEntity schema, ITagService tagService) { - Guard.NotNull(nodeIn); - Guard.NotNull(tagService); - Guard.NotNull(schema); + Guard.NotNull(nodeIn, nameof(nodeIn)); + Guard.NotNull(tagService, nameof(tagService)); + Guard.NotNull(schema, nameof(schema)); return nodeIn.Accept(new FilterTagTransformer(appId, schema, tagService)); } diff --git a/backend/src/Squidex.Domain.Apps.Entities/Contents/Queries/QueryExecutionContext.cs b/backend/src/Squidex.Domain.Apps.Entities/Contents/Queries/QueryExecutionContext.cs index 01589a7f0..5e00eaf6a 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Contents/Queries/QueryExecutionContext.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Contents/Queries/QueryExecutionContext.cs @@ -30,9 +30,9 @@ namespace Squidex.Domain.Apps.Entities.Contents.Queries public QueryExecutionContext(Context context, IAssetQueryService assetQuery, IContentQueryService contentQuery) { - Guard.NotNull(assetQuery); - Guard.NotNull(contentQuery); - Guard.NotNull(context); + Guard.NotNull(assetQuery, nameof(assetQuery)); + Guard.NotNull(contentQuery, nameof(contentQuery)); + Guard.NotNull(context, nameof(context)); this.assetQuery = assetQuery; this.contentQuery = contentQuery; @@ -99,7 +99,7 @@ namespace Squidex.Domain.Apps.Entities.Contents.Queries public virtual async Task> GetReferencedAssetsAsync(ICollection ids) { - Guard.NotNull(ids); + Guard.NotNull(ids, nameof(ids)); var notLoadedAssets = new HashSet(ids.Where(id => !cachedAssets.ContainsKey(id))); @@ -118,7 +118,7 @@ namespace Squidex.Domain.Apps.Entities.Contents.Queries public virtual async Task> GetReferencedContentsAsync(ICollection ids) { - Guard.NotNull(ids); + Guard.NotNull(ids, nameof(ids)); var notLoadedContents = ids.Where(id => !cachedContents.ContainsKey(id)).ToList(); diff --git a/backend/src/Squidex.Domain.Apps.Entities/Contents/Queries/Steps/ConvertData.cs b/backend/src/Squidex.Domain.Apps.Entities/Contents/Queries/Steps/ConvertData.cs index 5a9192fc7..27383a6bc 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Contents/Queries/Steps/ConvertData.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Contents/Queries/Steps/ConvertData.cs @@ -26,9 +26,9 @@ namespace Squidex.Domain.Apps.Entities.Contents.Queries.Steps public ConvertData(IUrlGenerator urlGenerator, IAssetRepository assetRepository, IContentRepository contentRepository) { - Guard.NotNull(urlGenerator); - Guard.NotNull(assetRepository); - Guard.NotNull(contentRepository); + Guard.NotNull(urlGenerator, nameof(urlGenerator)); + Guard.NotNull(assetRepository, nameof(assetRepository)); + Guard.NotNull(contentRepository, nameof(contentRepository)); this.urlGenerator = urlGenerator; this.assetRepository = assetRepository; diff --git a/backend/src/Squidex.Domain.Apps.Entities/Contents/Queries/Steps/EnrichForCaching.cs b/backend/src/Squidex.Domain.Apps.Entities/Contents/Queries/Steps/EnrichForCaching.cs index ce41cfff6..b5dc3d10e 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Contents/Queries/Steps/EnrichForCaching.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Contents/Queries/Steps/EnrichForCaching.cs @@ -19,7 +19,7 @@ namespace Squidex.Domain.Apps.Entities.Contents.Queries.Steps public EnrichForCaching(IRequestCache requestCache) { - Guard.NotNull(requestCache); + Guard.NotNull(requestCache, nameof(requestCache)); this.requestCache = requestCache; } diff --git a/backend/src/Squidex.Domain.Apps.Entities/Contents/Queries/Steps/EnrichWithWorkflows.cs b/backend/src/Squidex.Domain.Apps.Entities/Contents/Queries/Steps/EnrichWithWorkflows.cs index e89d969d8..8deaff880 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Contents/Queries/Steps/EnrichWithWorkflows.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Contents/Queries/Steps/EnrichWithWorkflows.cs @@ -21,7 +21,7 @@ namespace Squidex.Domain.Apps.Entities.Contents.Queries.Steps public EnrichWithWorkflows(IContentWorkflow contentWorkflow) { - Guard.NotNull(contentWorkflow); + Guard.NotNull(contentWorkflow, nameof(contentWorkflow)); this.contentWorkflow = contentWorkflow; } diff --git a/backend/src/Squidex.Domain.Apps.Entities/Contents/Queries/Steps/ResolveAssets.cs b/backend/src/Squidex.Domain.Apps.Entities/Contents/Queries/Steps/ResolveAssets.cs index 2da34658b..e41056e11 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Contents/Queries/Steps/ResolveAssets.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Contents/Queries/Steps/ResolveAssets.cs @@ -32,9 +32,9 @@ namespace Squidex.Domain.Apps.Entities.Contents.Queries.Steps public ResolveAssets(IUrlGenerator urlGenerator, IAssetQueryService assetQuery, IRequestCache requestCache) { - Guard.NotNull(urlGenerator); - Guard.NotNull(assetQuery); - Guard.NotNull(requestCache); + Guard.NotNull(urlGenerator, nameof(urlGenerator)); + Guard.NotNull(assetQuery, nameof(assetQuery)); + Guard.NotNull(requestCache, nameof(requestCache)); this.urlGenerator = urlGenerator; this.assetQuery = assetQuery; diff --git a/backend/src/Squidex.Domain.Apps.Entities/Contents/Queries/Steps/ResolveReferences.cs b/backend/src/Squidex.Domain.Apps.Entities/Contents/Queries/Steps/ResolveReferences.cs index 15699be08..d81b3cca7 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Contents/Queries/Steps/ResolveReferences.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Contents/Queries/Steps/ResolveReferences.cs @@ -32,8 +32,8 @@ namespace Squidex.Domain.Apps.Entities.Contents.Queries.Steps public ResolveReferences(Lazy contentQuery, IRequestCache requestCache) { - Guard.NotNull(contentQuery); - Guard.NotNull(requestCache); + Guard.NotNull(contentQuery, nameof(contentQuery)); + Guard.NotNull(requestCache, nameof(requestCache)); this.contentQuery = contentQuery; diff --git a/backend/src/Squidex.Domain.Apps.Entities/Contents/Queries/Steps/ScriptContent.cs b/backend/src/Squidex.Domain.Apps.Entities/Contents/Queries/Steps/ScriptContent.cs index 7e954d258..721e9f7d0 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Contents/Queries/Steps/ScriptContent.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Contents/Queries/Steps/ScriptContent.cs @@ -19,7 +19,7 @@ namespace Squidex.Domain.Apps.Entities.Contents.Queries.Steps public ScriptContent(IScriptEngine scriptEngine) { - Guard.NotNull(scriptEngine); + Guard.NotNull(scriptEngine, nameof(scriptEngine)); this.scriptEngine = scriptEngine; } diff --git a/backend/src/Squidex.Domain.Apps.Entities/Contents/State/ContentVersion.cs b/backend/src/Squidex.Domain.Apps.Entities/Contents/State/ContentVersion.cs index 4175fb21d..f0955a28e 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Contents/State/ContentVersion.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Contents/State/ContentVersion.cs @@ -18,7 +18,7 @@ namespace Squidex.Domain.Apps.Entities.Contents.State public ContentVersion(Status status, NamedContentData data) { - Guard.NotNull(data); + Guard.NotNull(data, nameof(data)); Status = status; diff --git a/backend/src/Squidex.Domain.Apps.Entities/Contents/Text/Lucene/IndexManager.cs b/backend/src/Squidex.Domain.Apps.Entities/Contents/Text/Lucene/IndexManager.cs index 82de5a132..0aa3ccbab 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Contents/Text/Lucene/IndexManager.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Contents/Text/Lucene/IndexManager.cs @@ -24,8 +24,8 @@ namespace Squidex.Domain.Apps.Entities.Contents.Text.Lucene public IndexManager(IIndexStorage indexStorage, ISemanticLog log) { - Guard.NotNull(indexStorage); - Guard.NotNull(log); + Guard.NotNull(indexStorage, nameof(indexStorage)); + Guard.NotNull(log, nameof(log)); this.indexStorage = indexStorage; @@ -79,7 +79,7 @@ namespace Squidex.Domain.Apps.Entities.Contents.Text.Lucene public async Task ReleaseAsync(IIndex index) { - Guard.NotNull(index); + Guard.NotNull(index, nameof(index)); var indexHolder = (IndexHolder)index; @@ -100,7 +100,7 @@ namespace Squidex.Domain.Apps.Entities.Contents.Text.Lucene public Task CommitAsync(IIndex index) { - Guard.NotNull(index); + Guard.NotNull(index, nameof(index)); return CommitInternalAsync(index, false); } diff --git a/backend/src/Squidex.Domain.Apps.Entities/Contents/Text/Lucene/IndexManager_Impl.cs b/backend/src/Squidex.Domain.Apps.Entities/Contents/Text/Lucene/IndexManager_Impl.cs index add29e416..313d4b462 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Contents/Text/Lucene/IndexManager_Impl.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Contents/Text/Lucene/IndexManager_Impl.cs @@ -84,7 +84,7 @@ namespace Squidex.Domain.Apps.Entities.Contents.Text.Lucene public void Open(Directory directory) { - Guard.NotNull(directory); + Guard.NotNull(directory, nameof(directory)); this.directory = directory; diff --git a/backend/src/Squidex.Domain.Apps.Entities/Contents/Text/Lucene/LuceneTextIndex.cs b/backend/src/Squidex.Domain.Apps.Entities/Contents/Text/Lucene/LuceneTextIndex.cs index e6cc8f8d4..623beebbf 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Contents/Text/Lucene/LuceneTextIndex.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Contents/Text/Lucene/LuceneTextIndex.cs @@ -23,8 +23,8 @@ namespace Squidex.Domain.Apps.Entities.Contents.Text.Lucene public LuceneTextIndex(IGrainFactory grainFactory, IndexManager indexManager) { - Guard.NotNull(grainFactory); - Guard.NotNull(indexManager); + Guard.NotNull(grainFactory, nameof(grainFactory)); + Guard.NotNull(indexManager, nameof(indexManager)); this.grainFactory = grainFactory; diff --git a/backend/src/Squidex.Domain.Apps.Entities/Contents/Text/Lucene/LuceneTextIndexGrain.cs b/backend/src/Squidex.Domain.Apps.Entities/Contents/Text/Lucene/LuceneTextIndexGrain.cs index ccc44d582..57cbd81fd 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Contents/Text/Lucene/LuceneTextIndexGrain.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Contents/Text/Lucene/LuceneTextIndexGrain.cs @@ -43,7 +43,7 @@ namespace Squidex.Domain.Apps.Entities.Contents.Text.Lucene public LuceneTextIndexGrain(IndexManager indexManager) { - Guard.NotNull(indexManager); + Guard.NotNull(indexManager, nameof(indexManager)); this.indexManager = indexManager; } diff --git a/backend/src/Squidex.Domain.Apps.Entities/Contents/Text/Lucene/Storage/AssetIndexStorage.cs b/backend/src/Squidex.Domain.Apps.Entities/Contents/Text/Lucene/Storage/AssetIndexStorage.cs index 4ff2d87e2..24703e09f 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Contents/Text/Lucene/Storage/AssetIndexStorage.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Contents/Text/Lucene/Storage/AssetIndexStorage.cs @@ -24,7 +24,7 @@ namespace Squidex.Domain.Apps.Entities.Contents.Text.Lucene.Storage public AssetIndexStorage(IAssetStore assetStore) { - Guard.NotNull(assetStore); + Guard.NotNull(assetStore, nameof(assetStore)); this.assetStore = assetStore; } diff --git a/backend/src/Squidex.Domain.Apps.Entities/Contents/Text/SearchFilter.cs b/backend/src/Squidex.Domain.Apps.Entities/Contents/Text/SearchFilter.cs index f6b1112f6..d34cfff41 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Contents/Text/SearchFilter.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Contents/Text/SearchFilter.cs @@ -21,7 +21,7 @@ namespace Squidex.Domain.Apps.Entities.Contents.Text public SearchFilter(IReadOnlyList schemaIds, bool must) { - Guard.NotNull(schemaIds); + Guard.NotNull(schemaIds, nameof(schemaIds)); SchemaIds = schemaIds; diff --git a/backend/src/Squidex.Domain.Apps.Entities/Contents/Text/State/CachingTextIndexerState.cs b/backend/src/Squidex.Domain.Apps.Entities/Contents/Text/State/CachingTextIndexerState.cs index 8c11c9d6f..7d057b006 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Contents/Text/State/CachingTextIndexerState.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Contents/Text/State/CachingTextIndexerState.cs @@ -19,7 +19,7 @@ namespace Squidex.Domain.Apps.Entities.Contents.Text.State public CachingTextIndexerState(ITextIndexerState inner) { - Guard.NotNull(inner); + Guard.NotNull(inner, nameof(inner)); this.inner = inner; } @@ -47,7 +47,7 @@ namespace Squidex.Domain.Apps.Entities.Contents.Text.State public Task SetAsync(TextContentState state) { - Guard.NotNull(state); + Guard.NotNull(state, nameof(state)); cache.Set(state.ContentId, Tuple.Create(state)); diff --git a/backend/src/Squidex.Domain.Apps.Entities/Contents/Text/TextIndexingProcess.cs b/backend/src/Squidex.Domain.Apps.Entities/Contents/Text/TextIndexingProcess.cs index 784d9456c..2fe8cd4f7 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Contents/Text/TextIndexingProcess.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Contents/Text/TextIndexingProcess.cs @@ -37,8 +37,8 @@ namespace Squidex.Domain.Apps.Entities.Contents.Text public TextIndexingProcess(ITextIndex textIndexer, ITextIndexerState textIndexerState) { - Guard.NotNull(textIndexer); - Guard.NotNull(textIndexerState); + Guard.NotNull(textIndexer, nameof(textIndexer)); + Guard.NotNull(textIndexerState, nameof(textIndexerState)); this.textIndexer = textIndexer; this.textIndexerState = textIndexerState; diff --git a/backend/src/Squidex.Domain.Apps.Entities/Contents/Validation/DependencyValidatorsFactory.cs b/backend/src/Squidex.Domain.Apps.Entities/Contents/Validation/DependencyValidatorsFactory.cs index c0e6a93cc..324cdc391 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Contents/Validation/DependencyValidatorsFactory.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Contents/Validation/DependencyValidatorsFactory.cs @@ -23,8 +23,8 @@ namespace Squidex.Domain.Apps.Entities.Contents.Validation public DependencyValidatorsFactory(IAssetRepository assetRepository, IContentRepository contentRepository) { - Guard.NotNull(assetRepository); - Guard.NotNull(contentRepository); + Guard.NotNull(assetRepository, nameof(assetRepository)); + Guard.NotNull(contentRepository, nameof(contentRepository)); this.assetRepository = assetRepository; this.contentRepository = contentRepository; diff --git a/backend/src/Squidex.Domain.Apps.Entities/Context.cs b/backend/src/Squidex.Domain.Apps.Entities/Context.cs index 832b4e67c..7b73acb90 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Context.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Context.cs @@ -31,7 +31,7 @@ namespace Squidex.Domain.Apps.Entities public Context(ClaimsPrincipal user) { - Guard.NotNull(user); + Guard.NotNull(user, nameof(user)); User = user; diff --git a/backend/src/Squidex.Domain.Apps.Entities/EventStoreInitializer.cs b/backend/src/Squidex.Domain.Apps.Entities/EventStoreInitializer.cs index 83d513a9f..abcd8f12a 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/EventStoreInitializer.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/EventStoreInitializer.cs @@ -21,7 +21,7 @@ namespace Squidex.Domain.Apps.Entities public EventStoreInitializer(IEventStore eventStore) { - Guard.NotNull(eventStore); + Guard.NotNull(eventStore, nameof(eventStore)); this.eventStore = eventStore; } diff --git a/backend/src/Squidex.Domain.Apps.Entities/History/HistoryEvent.cs b/backend/src/Squidex.Domain.Apps.Entities/History/HistoryEvent.cs index 8011e3430..e3a20e89c 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/History/HistoryEvent.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/History/HistoryEvent.cs @@ -36,8 +36,8 @@ namespace Squidex.Domain.Apps.Entities.History public HistoryEvent(string channel, string eventType) { - Guard.NotNullOrEmpty(channel); - Guard.NotNullOrEmpty(eventType); + Guard.NotNullOrEmpty(channel, nameof(channel)); + Guard.NotNullOrEmpty(eventType, nameof(eventType)); Channel = channel; diff --git a/backend/src/Squidex.Domain.Apps.Entities/History/HistoryEventsCreatorBase.cs b/backend/src/Squidex.Domain.Apps.Entities/History/HistoryEventsCreatorBase.cs index 5b85a97fe..1874f014f 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/History/HistoryEventsCreatorBase.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/History/HistoryEventsCreatorBase.cs @@ -25,14 +25,14 @@ namespace Squidex.Domain.Apps.Entities.History protected HistoryEventsCreatorBase(TypeNameRegistry typeNameRegistry) { - Guard.NotNull(typeNameRegistry); + Guard.NotNull(typeNameRegistry, nameof(typeNameRegistry)); this.typeNameRegistry = typeNameRegistry; } protected void AddEventMessage(string message) where TEvent : IEvent { - Guard.NotNullOrEmpty(message); + Guard.NotNullOrEmpty(message, nameof(message)); texts[typeNameRegistry.GetName()] = message; } diff --git a/backend/src/Squidex.Domain.Apps.Entities/History/HistoryService.cs b/backend/src/Squidex.Domain.Apps.Entities/History/HistoryService.cs index a1d7c5dc5..b79fe4590 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/History/HistoryService.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/History/HistoryService.cs @@ -34,8 +34,8 @@ namespace Squidex.Domain.Apps.Entities.History public HistoryService(IHistoryEventRepository repository, IEnumerable creators) { - Guard.NotNull(repository); - Guard.NotNull(creators); + Guard.NotNull(repository, nameof(repository)); + Guard.NotNull(creators, nameof(creators)); this.creators = creators.ToList(); diff --git a/backend/src/Squidex.Domain.Apps.Entities/Notifications/NotificationEmailSender.cs b/backend/src/Squidex.Domain.Apps.Entities/Notifications/NotificationEmailSender.cs index 402b73f05..92c1e545a 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Notifications/NotificationEmailSender.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Notifications/NotificationEmailSender.cs @@ -49,10 +49,10 @@ namespace Squidex.Domain.Apps.Entities.Apps.Notifications IUrlGenerator urlGenerator, ISemanticLog log) { - Guard.NotNull(texts); - Guard.NotNull(emailSender); - Guard.NotNull(urlGenerator); - Guard.NotNull(log); + Guard.NotNull(texts, nameof(texts)); + Guard.NotNull(emailSender, nameof(emailSender)); + Guard.NotNull(urlGenerator, nameof(urlGenerator)); + Guard.NotNull(log, nameof(log)); this.texts = texts.Value; this.emailSender = emailSender; @@ -62,8 +62,8 @@ namespace Squidex.Domain.Apps.Entities.Apps.Notifications public Task SendUsageAsync(IUser user, string appName, long usage, long usageLimit) { - Guard.NotNull(user); - Guard.NotNull(appName); + Guard.NotNull(user, nameof(user)); + Guard.NotNull(appName, nameof(appName)); var vars = new TemplatesVars { @@ -80,9 +80,9 @@ namespace Squidex.Domain.Apps.Entities.Apps.Notifications public Task SendInviteAsync(IUser assigner, IUser user, string appName) { - Guard.NotNull(assigner); - Guard.NotNull(user); - Guard.NotNull(appName); + Guard.NotNull(assigner, nameof(assigner)); + Guard.NotNull(user, nameof(user)); + Guard.NotNull(appName, nameof(appName)); var vars = new TemplatesVars { Assigner = assigner, AppName = appName }; diff --git a/backend/src/Squidex.Domain.Apps.Entities/Rules/BackupRules.cs b/backend/src/Squidex.Domain.Apps.Entities/Rules/BackupRules.cs index fc8f38390..c8425f9cc 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Rules/BackupRules.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Rules/BackupRules.cs @@ -25,7 +25,7 @@ namespace Squidex.Domain.Apps.Entities.Rules public BackupRules(IRulesIndex indexForRules) { - Guard.NotNull(indexForRules); + Guard.NotNull(indexForRules, nameof(indexForRules)); this.indexForRules = indexForRules; } diff --git a/backend/src/Squidex.Domain.Apps.Entities/Rules/Guards/GuardRule.cs b/backend/src/Squidex.Domain.Apps.Entities/Rules/Guards/GuardRule.cs index 4717de200..66a7ae204 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Rules/Guards/GuardRule.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Rules/Guards/GuardRule.cs @@ -17,7 +17,7 @@ namespace Squidex.Domain.Apps.Entities.Rules.Guards { public static Task CanCreate(CreateRule command, IAppProvider appProvider) { - Guard.NotNull(command); + Guard.NotNull(command, nameof(command)); return Validate.It(() => "Cannot create rule.", async e => { @@ -47,7 +47,7 @@ namespace Squidex.Domain.Apps.Entities.Rules.Guards public static Task CanUpdate(UpdateRule command, Guid appId, IAppProvider appProvider) { - Guard.NotNull(command); + Guard.NotNull(command, nameof(command)); return Validate.It(() => "Cannot update rule.", async e => { @@ -74,17 +74,17 @@ namespace Squidex.Domain.Apps.Entities.Rules.Guards public static void CanEnable(EnableRule command) { - Guard.NotNull(command); + Guard.NotNull(command, nameof(command)); } public static void CanDisable(DisableRule command) { - Guard.NotNull(command); + Guard.NotNull(command, nameof(command)); } public static void CanDelete(DeleteRule command) { - Guard.NotNull(command); + Guard.NotNull(command, nameof(command)); } } } diff --git a/backend/src/Squidex.Domain.Apps.Entities/Rules/Guards/RuleTriggerValidator.cs b/backend/src/Squidex.Domain.Apps.Entities/Rules/Guards/RuleTriggerValidator.cs index 7af78b81b..3d7841798 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Rules/Guards/RuleTriggerValidator.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Rules/Guards/RuleTriggerValidator.cs @@ -28,8 +28,8 @@ namespace Squidex.Domain.Apps.Entities.Rules.Guards public static Task> ValidateAsync(Guid appId, RuleTrigger action, IAppProvider appProvider) { - Guard.NotNull(action); - Guard.NotNull(appProvider); + Guard.NotNull(action, nameof(action)); + Guard.NotNull(appProvider, nameof(appProvider)); var visitor = new RuleTriggerValidator(x => appProvider.GetSchemaAsync(appId, x)); diff --git a/backend/src/Squidex.Domain.Apps.Entities/Rules/Indexes/RulesIndex.cs b/backend/src/Squidex.Domain.Apps.Entities/Rules/Indexes/RulesIndex.cs index 11f7b5dff..f26ba274e 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Rules/Indexes/RulesIndex.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Rules/Indexes/RulesIndex.cs @@ -23,7 +23,7 @@ namespace Squidex.Domain.Apps.Entities.Rules.Indexes public RulesIndex(IGrainFactory grainFactory) { - Guard.NotNull(grainFactory); + Guard.NotNull(grainFactory, nameof(grainFactory)); this.grainFactory = grainFactory; } diff --git a/backend/src/Squidex.Domain.Apps.Entities/Rules/Queries/RuleEnricher.cs b/backend/src/Squidex.Domain.Apps.Entities/Rules/Queries/RuleEnricher.cs index d1fb27d69..83b647c5c 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Rules/Queries/RuleEnricher.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Rules/Queries/RuleEnricher.cs @@ -23,8 +23,8 @@ namespace Squidex.Domain.Apps.Entities.Rules.Queries public RuleEnricher(IRuleEventRepository ruleEventRepository, IRequestCache requestCache) { - Guard.NotNull(ruleEventRepository); - Guard.NotNull(requestCache); + Guard.NotNull(ruleEventRepository, nameof(ruleEventRepository)); + Guard.NotNull(requestCache, nameof(requestCache)); this.ruleEventRepository = ruleEventRepository; @@ -33,7 +33,7 @@ namespace Squidex.Domain.Apps.Entities.Rules.Queries public async Task EnrichAsync(IRuleEntity rule, Context context) { - Guard.NotNull(rule); + Guard.NotNull(rule, nameof(rule)); var enriched = await EnrichAsync(Enumerable.Repeat(rule, 1), context); @@ -42,8 +42,8 @@ namespace Squidex.Domain.Apps.Entities.Rules.Queries public async Task> EnrichAsync(IEnumerable rules, Context context) { - Guard.NotNull(rules); - Guard.NotNull(context); + Guard.NotNull(rules, nameof(rules)); + Guard.NotNull(context, nameof(context)); using (Profiler.TraceMethod()) { diff --git a/backend/src/Squidex.Domain.Apps.Entities/Rules/Queries/RuleQueryService.cs b/backend/src/Squidex.Domain.Apps.Entities/Rules/Queries/RuleQueryService.cs index e22acb830..a470206e1 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Rules/Queries/RuleQueryService.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Rules/Queries/RuleQueryService.cs @@ -19,8 +19,8 @@ namespace Squidex.Domain.Apps.Entities.Rules.Queries public RuleQueryService(IRulesIndex rulesIndex, IRuleEnricher ruleEnricher) { - Guard.NotNull(rulesIndex); - Guard.NotNull(ruleEnricher); + Guard.NotNull(rulesIndex, nameof(rulesIndex)); + Guard.NotNull(ruleEnricher, nameof(ruleEnricher)); this.rulesIndex = rulesIndex; this.ruleEnricher = ruleEnricher; diff --git a/backend/src/Squidex.Domain.Apps.Entities/Rules/RuleCommandMiddleware.cs b/backend/src/Squidex.Domain.Apps.Entities/Rules/RuleCommandMiddleware.cs index 963e0f0fe..4c8541c15 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Rules/RuleCommandMiddleware.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Rules/RuleCommandMiddleware.cs @@ -21,8 +21,8 @@ namespace Squidex.Domain.Apps.Entities.Rules public RuleCommandMiddleware(IGrainFactory grainFactory, IRuleEnricher ruleEnricher, IContextProvider contextProvider) : base(grainFactory) { - Guard.NotNull(ruleEnricher); - Guard.NotNull(contextProvider); + Guard.NotNull(ruleEnricher, nameof(ruleEnricher)); + Guard.NotNull(contextProvider, nameof(contextProvider)); this.ruleEnricher = ruleEnricher; diff --git a/backend/src/Squidex.Domain.Apps.Entities/Rules/RuleDequeuerGrain.cs b/backend/src/Squidex.Domain.Apps.Entities/Rules/RuleDequeuerGrain.cs index 92f3e6243..a44892d92 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Rules/RuleDequeuerGrain.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Rules/RuleDequeuerGrain.cs @@ -32,10 +32,10 @@ namespace Squidex.Domain.Apps.Entities.Rules public RuleDequeuerGrain(RuleService ruleService, IRuleEventRepository ruleEventRepository, ISemanticLog log, IClock clock) { - Guard.NotNull(ruleEventRepository); - Guard.NotNull(ruleService); - Guard.NotNull(clock); - Guard.NotNull(log); + Guard.NotNull(ruleEventRepository, nameof(ruleEventRepository)); + Guard.NotNull(ruleService, nameof(ruleService)); + Guard.NotNull(clock, nameof(clock)); + Guard.NotNull(log, nameof(log)); this.ruleEventRepository = ruleEventRepository; this.ruleService = ruleService; diff --git a/backend/src/Squidex.Domain.Apps.Entities/Rules/RuleDomainObject.cs b/backend/src/Squidex.Domain.Apps.Entities/Rules/RuleDomainObject.cs index 1bf1afc38..3f14da2dd 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Rules/RuleDomainObject.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Rules/RuleDomainObject.cs @@ -29,8 +29,8 @@ namespace Squidex.Domain.Apps.Entities.Rules public RuleDomainObject(IStore store, ISemanticLog log, IAppProvider appProvider, IRuleEnqueuer ruleEnqueuer) : base(store, log) { - Guard.NotNull(appProvider); - Guard.NotNull(ruleEnqueuer); + Guard.NotNull(appProvider, nameof(appProvider)); + Guard.NotNull(ruleEnqueuer, nameof(ruleEnqueuer)); this.appProvider = appProvider; diff --git a/backend/src/Squidex.Domain.Apps.Entities/Rules/RuleEnqueuer.cs b/backend/src/Squidex.Domain.Apps.Entities/Rules/RuleEnqueuer.cs index 80f20a853..f934c86c8 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Rules/RuleEnqueuer.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Rules/RuleEnqueuer.cs @@ -39,10 +39,10 @@ namespace Squidex.Domain.Apps.Entities.Rules public RuleEnqueuer(IAppProvider appProvider, IMemoryCache cache, IRuleEventRepository ruleEventRepository, RuleService ruleService) { - Guard.NotNull(appProvider); - Guard.NotNull(cache); - Guard.NotNull(ruleEventRepository); - Guard.NotNull(ruleService); + Guard.NotNull(appProvider, nameof(appProvider)); + Guard.NotNull(cache, nameof(cache)); + Guard.NotNull(ruleEventRepository, nameof(ruleEventRepository)); + Guard.NotNull(ruleService, nameof(ruleService)); this.appProvider = appProvider; @@ -64,8 +64,8 @@ namespace Squidex.Domain.Apps.Entities.Rules public async Task Enqueue(Rule rule, Guid ruleId, Envelope @event) { - Guard.NotNull(rule); - Guard.NotNull(@event); + Guard.NotNull(rule, nameof(rule)); + Guard.NotNull(@event, nameof(@event)); var jobs = await ruleService.CreateJobsAsync(rule, ruleId, @event); diff --git a/backend/src/Squidex.Domain.Apps.Entities/Rules/Runner/GrainRuleRunnerService.cs b/backend/src/Squidex.Domain.Apps.Entities/Rules/Runner/GrainRuleRunnerService.cs index 10dfd6b36..4262ad8cb 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Rules/Runner/GrainRuleRunnerService.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Rules/Runner/GrainRuleRunnerService.cs @@ -18,7 +18,7 @@ namespace Squidex.Domain.Apps.Entities.Rules.Runner public GrainRuleRunnerService(IGrainFactory grainFactory) { - Guard.NotNull(grainFactory); + Guard.NotNull(grainFactory, nameof(grainFactory)); this.grainFactory = grainFactory; } diff --git a/backend/src/Squidex.Domain.Apps.Entities/Rules/Runner/RuleRunnerGrain.cs b/backend/src/Squidex.Domain.Apps.Entities/Rules/Runner/RuleRunnerGrain.cs index e0c047afd..1a3bbcc79 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Rules/Runner/RuleRunnerGrain.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Rules/Runner/RuleRunnerGrain.cs @@ -52,13 +52,13 @@ namespace Squidex.Domain.Apps.Entities.Rules.Runner RuleService ruleService, ISemanticLog log) { - Guard.NotNull(state); - Guard.NotNull(appProvider); - Guard.NotNull(eventStore); - Guard.NotNull(eventDataFormatter); - Guard.NotNull(ruleEventRepository); - Guard.NotNull(ruleService); - Guard.NotNull(log); + Guard.NotNull(state, nameof(state)); + Guard.NotNull(appProvider, nameof(appProvider)); + Guard.NotNull(eventStore, nameof(eventStore)); + Guard.NotNull(eventDataFormatter, nameof(eventDataFormatter)); + Guard.NotNull(ruleEventRepository, nameof(ruleEventRepository)); + Guard.NotNull(ruleService, nameof(ruleService)); + Guard.NotNull(log, nameof(log)); this.state = state; this.appProvider = appProvider; diff --git a/backend/src/Squidex.Domain.Apps.Entities/Rules/UsageTracking/UsageTrackerCommandMiddleware.cs b/backend/src/Squidex.Domain.Apps.Entities/Rules/UsageTracking/UsageTrackerCommandMiddleware.cs index 4e1d5294a..8431cc114 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Rules/UsageTracking/UsageTrackerCommandMiddleware.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Rules/UsageTracking/UsageTrackerCommandMiddleware.cs @@ -21,7 +21,7 @@ namespace Squidex.Domain.Apps.Entities.Rules.UsageTracking public UsageTrackerCommandMiddleware(IGrainFactory grainFactory) { - Guard.NotNull(grainFactory); + Guard.NotNull(grainFactory, nameof(grainFactory)); usageTrackerGrain = grainFactory.GetGrain(SingleGrain.Id); } diff --git a/backend/src/Squidex.Domain.Apps.Entities/Rules/UsageTracking/UsageTrackerGrain.cs b/backend/src/Squidex.Domain.Apps.Entities/Rules/UsageTracking/UsageTrackerGrain.cs index 21a59fabc..8edaf0882 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Rules/UsageTracking/UsageTrackerGrain.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Rules/UsageTracking/UsageTrackerGrain.cs @@ -45,8 +45,8 @@ namespace Squidex.Domain.Apps.Entities.Rules.UsageTracking public UsageTrackerGrain(IGrainState state, IApiUsageTracker usageTracker) { - Guard.NotNull(state); - Guard.NotNull(usageTracker); + Guard.NotNull(state, nameof(state)); + Guard.NotNull(usageTracker, nameof(usageTracker)); this.state = state; diff --git a/backend/src/Squidex.Domain.Apps.Entities/Schemas/BackupSchemas.cs b/backend/src/Squidex.Domain.Apps.Entities/Schemas/BackupSchemas.cs index 55bd2b732..3767680fc 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Schemas/BackupSchemas.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Schemas/BackupSchemas.cs @@ -25,7 +25,7 @@ namespace Squidex.Domain.Apps.Entities.Schemas public BackupSchemas(ISchemasIndex indexSchemas) { - Guard.NotNull(indexSchemas); + Guard.NotNull(indexSchemas, nameof(indexSchemas)); this.indexSchemas = indexSchemas; } diff --git a/backend/src/Squidex.Domain.Apps.Entities/Schemas/Guards/GuardSchema.cs b/backend/src/Squidex.Domain.Apps.Entities/Schemas/Guards/GuardSchema.cs index 31ce88343..5ac8e78b5 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Schemas/Guards/GuardSchema.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Schemas/Guards/GuardSchema.cs @@ -23,7 +23,7 @@ namespace Squidex.Domain.Apps.Entities.Schemas.Guards { public static void CanCreate(CreateSchema command) { - Guard.NotNull(command); + Guard.NotNull(command, nameof(command)); Validate.It(() => "Cannot create schema.", e => { @@ -38,7 +38,7 @@ namespace Squidex.Domain.Apps.Entities.Schemas.Guards public static void CanSynchronize(SynchronizeSchema command) { - Guard.NotNull(command); + Guard.NotNull(command, nameof(command)); Validate.It(() => "Cannot synchronize schema.", e => { @@ -48,7 +48,7 @@ namespace Squidex.Domain.Apps.Entities.Schemas.Guards public static void CanReorder(ReorderFields command, Schema schema) { - Guard.NotNull(command); + Guard.NotNull(command, nameof(command)); IArrayField? arrayField = null; @@ -77,7 +77,7 @@ namespace Squidex.Domain.Apps.Entities.Schemas.Guards public static void CanConfigurePreviewUrls(ConfigurePreviewUrls command) { - Guard.NotNull(command); + Guard.NotNull(command, nameof(command)); Validate.It(() => "Cannot configure preview urls.", e => { @@ -90,7 +90,7 @@ namespace Squidex.Domain.Apps.Entities.Schemas.Guards public static void CanConfigureUIFields(ConfigureUIFields command, Schema schema) { - Guard.NotNull(command); + Guard.NotNull(command, nameof(command)); Validate.It(() => "Cannot configure UI fields.", e => { @@ -101,32 +101,32 @@ namespace Squidex.Domain.Apps.Entities.Schemas.Guards public static void CanPublish(PublishSchema command) { - Guard.NotNull(command); + Guard.NotNull(command, nameof(command)); } public static void CanUnpublish(UnpublishSchema command) { - Guard.NotNull(command); + Guard.NotNull(command, nameof(command)); } public static void CanUpdate(UpdateSchema command) { - Guard.NotNull(command); + Guard.NotNull(command, nameof(command)); } public static void CanConfigureScripts(ConfigureScripts command) { - Guard.NotNull(command); + Guard.NotNull(command, nameof(command)); } public static void CanChangeCategory(ChangeCategory command) { - Guard.NotNull(command); + Guard.NotNull(command, nameof(command)); } public static void CanDelete(DeleteSchema command) { - Guard.NotNull(command); + Guard.NotNull(command, nameof(command)); } private static void ValidateUpsert(UpsertCommand command, AddValidation e) diff --git a/backend/src/Squidex.Domain.Apps.Entities/Schemas/Guards/GuardSchemaField.cs b/backend/src/Squidex.Domain.Apps.Entities/Schemas/Guards/GuardSchemaField.cs index bdc71884a..2788f0387 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Schemas/Guards/GuardSchemaField.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Schemas/Guards/GuardSchemaField.cs @@ -17,7 +17,7 @@ namespace Squidex.Domain.Apps.Entities.Schemas.Guards { public static void CanAdd(AddField command, Schema schema) { - Guard.NotNull(command); + Guard.NotNull(command, nameof(command)); Validate.It(() => "Cannot add a new field.", e => { @@ -63,7 +63,7 @@ namespace Squidex.Domain.Apps.Entities.Schemas.Guards public static void CanUpdate(UpdateField command, Schema schema) { - Guard.NotNull(command); + Guard.NotNull(command, nameof(command)); GuardHelper.GetFieldOrThrow(schema, command.FieldId, command.ParentFieldId, false); @@ -84,7 +84,7 @@ namespace Squidex.Domain.Apps.Entities.Schemas.Guards public static void CanHide(HideField command, Schema schema) { - Guard.NotNull(command); + Guard.NotNull(command, nameof(command)); var field = GuardHelper.GetFieldOrThrow(schema, command.FieldId, command.ParentFieldId, false); @@ -96,7 +96,7 @@ namespace Squidex.Domain.Apps.Entities.Schemas.Guards public static void CanDisable(DisableField command, Schema schema) { - Guard.NotNull(command); + Guard.NotNull(command, nameof(command)); var field = GuardHelper.GetFieldOrThrow(schema, command.FieldId, command.ParentFieldId, false); @@ -108,7 +108,7 @@ namespace Squidex.Domain.Apps.Entities.Schemas.Guards public static void CanShow(ShowField command, Schema schema) { - Guard.NotNull(command); + Guard.NotNull(command, nameof(command)); var field = GuardHelper.GetFieldOrThrow(schema, command.FieldId, command.ParentFieldId, false); @@ -120,7 +120,7 @@ namespace Squidex.Domain.Apps.Entities.Schemas.Guards public static void CanEnable(EnableField command, Schema schema) { - Guard.NotNull(command); + Guard.NotNull(command, nameof(command)); var field = GuardHelper.GetFieldOrThrow(schema, command.FieldId, command.ParentFieldId, false); @@ -132,14 +132,14 @@ namespace Squidex.Domain.Apps.Entities.Schemas.Guards public static void CanDelete(DeleteField command, Schema schema) { - Guard.NotNull(command); + Guard.NotNull(command, nameof(command)); GuardHelper.GetFieldOrThrow(schema, command.FieldId, command.ParentFieldId, false); } public static void CanLock(LockField command, Schema schema) { - Guard.NotNull(command); + Guard.NotNull(command, nameof(command)); GuardHelper.GetFieldOrThrow(schema, command.FieldId, command.ParentFieldId, true); } diff --git a/backend/src/Squidex.Domain.Apps.Entities/Schemas/Indexes/SchemasIndex.cs b/backend/src/Squidex.Domain.Apps.Entities/Schemas/Indexes/SchemasIndex.cs index 2b374b1d9..c0a7b3ba4 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Schemas/Indexes/SchemasIndex.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Schemas/Indexes/SchemasIndex.cs @@ -24,7 +24,7 @@ namespace Squidex.Domain.Apps.Entities.Schemas.Indexes public SchemasIndex(IGrainFactory grainFactory) { - Guard.NotNull(grainFactory); + Guard.NotNull(grainFactory, nameof(grainFactory)); this.grainFactory = grainFactory; } diff --git a/backend/src/Squidex.Domain.Apps.Entities/Schemas/SchemaChangedTriggerHandler.cs b/backend/src/Squidex.Domain.Apps.Entities/Schemas/SchemaChangedTriggerHandler.cs index f8fd69840..0712d3b78 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Schemas/SchemaChangedTriggerHandler.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Schemas/SchemaChangedTriggerHandler.cs @@ -24,7 +24,7 @@ namespace Squidex.Domain.Apps.Entities.Schemas public SchemaChangedTriggerHandler(IScriptEngine scriptEngine) { - Guard.NotNull(scriptEngine); + Guard.NotNull(scriptEngine, nameof(scriptEngine)); this.scriptEngine = scriptEngine; } diff --git a/backend/src/Squidex.Domain.Apps.Entities/Schemas/SchemasSearchSource.cs b/backend/src/Squidex.Domain.Apps.Entities/Schemas/SchemasSearchSource.cs index 897d87b97..81eddcffc 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Schemas/SchemasSearchSource.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Schemas/SchemasSearchSource.cs @@ -23,8 +23,8 @@ namespace Squidex.Domain.Apps.Entities.Schemas public SchemasSearchSource(IAppProvider appProvider, IUrlGenerator urlGenerator) { - Guard.NotNull(appProvider); - Guard.NotNull(urlGenerator); + Guard.NotNull(appProvider, nameof(appProvider)); + Guard.NotNull(urlGenerator, nameof(urlGenerator)); this.appProvider = appProvider; diff --git a/backend/src/Squidex.Domain.Apps.Entities/Search/SearchManager.cs b/backend/src/Squidex.Domain.Apps.Entities/Search/SearchManager.cs index 79dfcf8fd..7afba438b 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Search/SearchManager.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Search/SearchManager.cs @@ -22,8 +22,8 @@ namespace Squidex.Domain.Apps.Entities.Search public SearchManager(IEnumerable searchSources, ISemanticLog log) { - Guard.NotNull(searchSources); - Guard.NotNull(log); + Guard.NotNull(searchSources, nameof(searchSources)); + Guard.NotNull(log, nameof(log)); this.searchSources = searchSources; diff --git a/backend/src/Squidex.Domain.Apps.Entities/Tags/GrainTagService.cs b/backend/src/Squidex.Domain.Apps.Entities/Tags/GrainTagService.cs index 6efb9e4d6..64a1dd13e 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Tags/GrainTagService.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Tags/GrainTagService.cs @@ -25,7 +25,7 @@ namespace Squidex.Domain.Apps.Entities.Tags public GrainTagService(IGrainFactory grainFactory) { - Guard.NotNull(grainFactory); + Guard.NotNull(grainFactory, nameof(grainFactory)); this.grainFactory = grainFactory; } @@ -67,7 +67,7 @@ namespace Squidex.Domain.Apps.Entities.Tags private ITagGrain GetGrain(Guid appId, string group) { - Guard.NotNullOrEmpty(group); + Guard.NotNullOrEmpty(group, nameof(group)); return grainFactory.GetGrain($"{appId}_{group}"); } diff --git a/backend/src/Squidex.Domain.Apps.Entities/Tags/TagGrain.cs b/backend/src/Squidex.Domain.Apps.Entities/Tags/TagGrain.cs index 794ebda20..a47a852b2 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Tags/TagGrain.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Tags/TagGrain.cs @@ -28,7 +28,7 @@ namespace Squidex.Domain.Apps.Entities.Tags public TagGrain(IGrainState state) { - Guard.NotNull(state); + Guard.NotNull(state, nameof(state)); this.state = state; } diff --git a/backend/src/Squidex.Domain.Users/DefaultUserPictureStore.cs b/backend/src/Squidex.Domain.Users/DefaultUserPictureStore.cs index 19762e222..01ec261e7 100644 --- a/backend/src/Squidex.Domain.Users/DefaultUserPictureStore.cs +++ b/backend/src/Squidex.Domain.Users/DefaultUserPictureStore.cs @@ -19,7 +19,7 @@ namespace Squidex.Domain.Users public DefaultUserPictureStore(IAssetStore assetStore) { - Guard.NotNull(assetStore); + Guard.NotNull(assetStore, nameof(assetStore)); this.assetStore = assetStore; } diff --git a/backend/src/Squidex.Domain.Users/DefaultUserResolver.cs b/backend/src/Squidex.Domain.Users/DefaultUserResolver.cs index f766e76fa..8da722640 100644 --- a/backend/src/Squidex.Domain.Users/DefaultUserResolver.cs +++ b/backend/src/Squidex.Domain.Users/DefaultUserResolver.cs @@ -24,14 +24,14 @@ namespace Squidex.Domain.Users public DefaultUserResolver(IServiceProvider serviceProvider) { - Guard.NotNull(serviceProvider); + Guard.NotNull(serviceProvider, nameof(serviceProvider)); this.serviceProvider = serviceProvider; } public async Task<(IUser? User, bool Created)> CreateUserIfNotExistsAsync(string email, bool invited) { - Guard.NotNullOrEmpty(email); + Guard.NotNullOrEmpty(email, nameof(email)); var created = false; @@ -67,7 +67,7 @@ namespace Squidex.Domain.Users public async Task FindByIdAsync(string idOrEmail) { - Guard.NotNullOrEmpty(idOrEmail); + Guard.NotNullOrEmpty(idOrEmail, nameof(idOrEmail)); using (var scope = serviceProvider.CreateScope()) { @@ -87,7 +87,7 @@ namespace Squidex.Domain.Users public async Task FindByIdOrEmailAsync(string idOrEmail) { - Guard.NotNullOrEmpty(idOrEmail); + Guard.NotNullOrEmpty(idOrEmail, nameof(idOrEmail)); using (var scope = serviceProvider.CreateScope()) { @@ -107,7 +107,7 @@ namespace Squidex.Domain.Users public async Task> QueryByEmailAsync(string email) { - Guard.NotNullOrEmpty(email); + Guard.NotNullOrEmpty(email, nameof(email)); using (var scope = serviceProvider.CreateScope()) { @@ -121,7 +121,7 @@ namespace Squidex.Domain.Users public async Task> QueryManyAsync(string[] ids) { - Guard.NotNull(ids); + Guard.NotNull(ids, nameof(ids)); using (var scope = serviceProvider.CreateScope()) { diff --git a/backend/src/Squidex.Domain.Users/DefaultXmlRepository.cs b/backend/src/Squidex.Domain.Users/DefaultXmlRepository.cs index 929e686a2..05020f01b 100644 --- a/backend/src/Squidex.Domain.Users/DefaultXmlRepository.cs +++ b/backend/src/Squidex.Domain.Users/DefaultXmlRepository.cs @@ -26,7 +26,7 @@ namespace Squidex.Domain.Users public DefaultXmlRepository(ISnapshotStore store) { - Guard.NotNull(store); + Guard.NotNull(store, nameof(store)); this.store = store; } diff --git a/backend/src/Squidex.Domain.Users/PwnedPasswordValidator.cs b/backend/src/Squidex.Domain.Users/PwnedPasswordValidator.cs index accc35925..08a2f8320 100644 --- a/backend/src/Squidex.Domain.Users/PwnedPasswordValidator.cs +++ b/backend/src/Squidex.Domain.Users/PwnedPasswordValidator.cs @@ -25,7 +25,7 @@ namespace Squidex.Domain.Users public PwnedPasswordValidator(ISemanticLog log) { - Guard.NotNull(log); + Guard.NotNull(log, nameof(log)); this.log = log; } diff --git a/backend/src/Squidex.Domain.Users/UserWithClaims.cs b/backend/src/Squidex.Domain.Users/UserWithClaims.cs index 462ca948f..541c42cd1 100644 --- a/backend/src/Squidex.Domain.Users/UserWithClaims.cs +++ b/backend/src/Squidex.Domain.Users/UserWithClaims.cs @@ -43,8 +43,8 @@ namespace Squidex.Domain.Users public UserWithClaims(IdentityUser user, IEnumerable claims) { - Guard.NotNull(user); - Guard.NotNull(claims); + Guard.NotNull(user, nameof(user)); + Guard.NotNull(claims, nameof(claims)); Identity = user; diff --git a/backend/src/Squidex.Infrastructure.Amazon/Assets/AmazonS3AssetStore.cs b/backend/src/Squidex.Infrastructure.Amazon/Assets/AmazonS3AssetStore.cs index feb585075..6e5462c2f 100644 --- a/backend/src/Squidex.Infrastructure.Amazon/Assets/AmazonS3AssetStore.cs +++ b/backend/src/Squidex.Infrastructure.Amazon/Assets/AmazonS3AssetStore.cs @@ -25,9 +25,9 @@ namespace Squidex.Infrastructure.Assets public AmazonS3AssetStore(AmazonS3Options options) { - Guard.NotNullOrEmpty(options.Bucket); - Guard.NotNullOrEmpty(options.AccessKey); - Guard.NotNullOrEmpty(options.SecretKey); + Guard.NotNullOrEmpty(options.Bucket, nameof(options.Bucket)); + Guard.NotNullOrEmpty(options.AccessKey, nameof(options.AccessKey)); + Guard.NotNullOrEmpty(options.SecretKey, nameof(options.SecretKey)); this.options = options; } @@ -132,7 +132,7 @@ namespace Squidex.Infrastructure.Assets public async Task DownloadAsync(string fileName, Stream stream, BytesRange range = default, CancellationToken ct = default) { - Guard.NotNull(stream); + Guard.NotNull(stream, nameof(stream)); var key = GetKey(fileName, nameof(fileName)); @@ -162,7 +162,7 @@ namespace Squidex.Infrastructure.Assets public async Task UploadAsync(string fileName, Stream stream, bool overwrite = false, CancellationToken ct = default) { - Guard.NotNull(stream); + Guard.NotNull(stream, nameof(stream)); var key = GetKey(fileName, nameof(fileName)); diff --git a/backend/src/Squidex.Infrastructure.Amazon/Assets/SeekFakerStream.cs b/backend/src/Squidex.Infrastructure.Amazon/Assets/SeekFakerStream.cs index 58e0a1809..e23562238 100644 --- a/backend/src/Squidex.Infrastructure.Amazon/Assets/SeekFakerStream.cs +++ b/backend/src/Squidex.Infrastructure.Amazon/Assets/SeekFakerStream.cs @@ -42,7 +42,7 @@ namespace Squidex.Infrastructure.Assets public SeekFakerStream(Stream inner) { - Guard.NotNull(inner); + Guard.NotNull(inner, nameof(inner)); if (!inner.CanRead) { diff --git a/backend/src/Squidex.Infrastructure.Azure/Assets/AzureBlobAssetStore.cs b/backend/src/Squidex.Infrastructure.Azure/Assets/AzureBlobAssetStore.cs index 755105bac..8712cb642 100644 --- a/backend/src/Squidex.Infrastructure.Azure/Assets/AzureBlobAssetStore.cs +++ b/backend/src/Squidex.Infrastructure.Azure/Assets/AzureBlobAssetStore.cs @@ -22,8 +22,8 @@ namespace Squidex.Infrastructure.Assets public AzureBlobAssetStore(string connectionString, string containerName) { - Guard.NotNullOrEmpty(containerName); - Guard.NotNullOrEmpty(connectionString); + Guard.NotNullOrEmpty(containerName, nameof(containerName)); + Guard.NotNullOrEmpty(connectionString, nameof(connectionString)); this.connectionString = connectionString; this.containerName = containerName; @@ -50,7 +50,7 @@ namespace Squidex.Infrastructure.Assets public string? GeneratePublicUrl(string fileName) { - Guard.NotNullOrEmpty(fileName); + Guard.NotNullOrEmpty(fileName, nameof(fileName)); if (blobContainer.Properties.PublicAccess != BlobContainerPublicAccessType.Blob) { @@ -64,7 +64,7 @@ namespace Squidex.Infrastructure.Assets public async Task GetSizeAsync(string fileName, CancellationToken ct = default) { - Guard.NotNullOrEmpty(fileName); + Guard.NotNullOrEmpty(fileName, nameof(fileName)); try { @@ -82,8 +82,8 @@ namespace Squidex.Infrastructure.Assets public async Task CopyAsync(string sourceFileName, string targetFileName, CancellationToken ct = default) { - Guard.NotNullOrEmpty(sourceFileName); - Guard.NotNullOrEmpty(targetFileName); + Guard.NotNullOrEmpty(sourceFileName, nameof(sourceFileName)); + Guard.NotNullOrEmpty(targetFileName, nameof(targetFileName)); try { @@ -118,8 +118,8 @@ namespace Squidex.Infrastructure.Assets public async Task DownloadAsync(string fileName, Stream stream, BytesRange range = default, CancellationToken ct = default) { - Guard.NotNullOrEmpty(fileName); - Guard.NotNull(stream); + Guard.NotNullOrEmpty(fileName, nameof(fileName)); + Guard.NotNull(stream, nameof(stream)); try { @@ -138,7 +138,7 @@ namespace Squidex.Infrastructure.Assets public async Task UploadAsync(string fileName, Stream stream, bool overwrite = false, CancellationToken ct = default) { - Guard.NotNullOrEmpty(fileName); + Guard.NotNullOrEmpty(fileName, nameof(fileName)); try { @@ -154,7 +154,7 @@ namespace Squidex.Infrastructure.Assets public Task DeleteAsync(string fileName) { - Guard.NotNullOrEmpty(fileName); + Guard.NotNullOrEmpty(fileName, nameof(fileName)); var blob = blobContainer.GetBlockBlobReference(fileName); diff --git a/backend/src/Squidex.Infrastructure.Azure/EventSourcing/CosmosDbEventStore.cs b/backend/src/Squidex.Infrastructure.Azure/EventSourcing/CosmosDbEventStore.cs index c9f549ded..933e60819 100644 --- a/backend/src/Squidex.Infrastructure.Azure/EventSourcing/CosmosDbEventStore.cs +++ b/backend/src/Squidex.Infrastructure.Azure/EventSourcing/CosmosDbEventStore.cs @@ -47,10 +47,10 @@ namespace Squidex.Infrastructure.EventSourcing public CosmosDbEventStore(DocumentClient documentClient, string masterKey, string database, JsonSerializerSettings serializerSettings) { - Guard.NotNull(documentClient); - Guard.NotNull(serializerSettings); - Guard.NotNullOrEmpty(masterKey); - Guard.NotNullOrEmpty(database); + Guard.NotNull(documentClient, nameof(documentClient)); + Guard.NotNull(serializerSettings, nameof(serializerSettings)); + Guard.NotNullOrEmpty(masterKey, nameof(masterKey)); + Guard.NotNullOrEmpty(database, nameof(database)); this.documentClient = documentClient; diff --git a/backend/src/Squidex.Infrastructure.Azure/EventSourcing/CosmosDbEventStore_Reader.cs b/backend/src/Squidex.Infrastructure.Azure/EventSourcing/CosmosDbEventStore_Reader.cs index a1164be89..b5e3e3860 100644 --- a/backend/src/Squidex.Infrastructure.Azure/EventSourcing/CosmosDbEventStore_Reader.cs +++ b/backend/src/Squidex.Infrastructure.Azure/EventSourcing/CosmosDbEventStore_Reader.cs @@ -23,7 +23,7 @@ namespace Squidex.Infrastructure.EventSourcing public IEventSubscription CreateSubscription(IEventSubscriber subscriber, string? streamFilter = null, string? position = null) { - Guard.NotNull(subscriber); + Guard.NotNull(subscriber, nameof(subscriber)); ThrowIfDisposed(); @@ -32,7 +32,7 @@ namespace Squidex.Infrastructure.EventSourcing public Task CreateIndexAsync(string property) { - Guard.NotNullOrEmpty(property); + Guard.NotNullOrEmpty(property, nameof(property)); ThrowIfDisposed(); @@ -41,7 +41,7 @@ namespace Squidex.Infrastructure.EventSourcing public async Task> QueryLatestAsync(string streamName, int count) { - Guard.NotNullOrEmpty(streamName); + Guard.NotNullOrEmpty(streamName, nameof(streamName)); ThrowIfDisposed(); @@ -89,7 +89,7 @@ namespace Squidex.Infrastructure.EventSourcing public async Task> QueryAsync(string streamName, long streamPosition = 0) { - Guard.NotNullOrEmpty(streamName); + Guard.NotNullOrEmpty(streamName, nameof(streamName)); ThrowIfDisposed(); @@ -128,9 +128,9 @@ namespace Squidex.Infrastructure.EventSourcing public Task QueryAsync(Func callback, string property, object value, string? position = null, CancellationToken ct = default) { - Guard.NotNull(callback); - Guard.NotNullOrEmpty(property); - Guard.NotNull(value); + Guard.NotNull(callback, nameof(callback)); + Guard.NotNullOrEmpty(property, nameof(property)); + Guard.NotNull(value, nameof(value)); ThrowIfDisposed(); @@ -144,7 +144,7 @@ namespace Squidex.Infrastructure.EventSourcing public Task QueryAsync(Func callback, string? streamFilter = null, string? position = null, CancellationToken ct = default) { - Guard.NotNull(callback); + Guard.NotNull(callback, nameof(callback)); ThrowIfDisposed(); diff --git a/backend/src/Squidex.Infrastructure.Azure/EventSourcing/CosmosDbEventStore_Writer.cs b/backend/src/Squidex.Infrastructure.Azure/EventSourcing/CosmosDbEventStore_Writer.cs index 6eeee9fd3..99e8690d0 100644 --- a/backend/src/Squidex.Infrastructure.Azure/EventSourcing/CosmosDbEventStore_Writer.cs +++ b/backend/src/Squidex.Infrastructure.Azure/EventSourcing/CosmosDbEventStore_Writer.cs @@ -23,7 +23,7 @@ namespace Squidex.Infrastructure.EventSourcing public Task DeleteStreamAsync(string streamName) { - Guard.NotNullOrEmpty(streamName); + Guard.NotNullOrEmpty(streamName, nameof(streamName)); ThrowIfDisposed(); @@ -49,9 +49,9 @@ namespace Squidex.Infrastructure.EventSourcing public async Task AppendAsync(Guid commitId, string streamName, long expectedVersion, ICollection events) { - Guard.NotEmpty(commitId); - Guard.NotNullOrEmpty(streamName); - Guard.NotNull(events); + Guard.NotEmpty(commitId, nameof(commitId)); + Guard.NotNullOrEmpty(streamName, nameof(streamName)); + Guard.NotNull(events, nameof(events)); Guard.LessThan(events.Count, MaxCommitSize, "events.Count"); ThrowIfDisposed(); diff --git a/backend/src/Squidex.Infrastructure.GetEventStore/Diagnostics/GetEventStoreHealthCheck.cs b/backend/src/Squidex.Infrastructure.GetEventStore/Diagnostics/GetEventStoreHealthCheck.cs index 983c3b83b..362972559 100644 --- a/backend/src/Squidex.Infrastructure.GetEventStore/Diagnostics/GetEventStoreHealthCheck.cs +++ b/backend/src/Squidex.Infrastructure.GetEventStore/Diagnostics/GetEventStoreHealthCheck.cs @@ -18,7 +18,7 @@ namespace Squidex.Infrastructure.Diagnostics public GetEventStoreHealthCheck(IEventStoreConnection connection) { - Guard.NotNull(connection); + Guard.NotNull(connection, nameof(connection)); this.connection = connection; } diff --git a/backend/src/Squidex.Infrastructure.GetEventStore/EventSourcing/GetEventStore.cs b/backend/src/Squidex.Infrastructure.GetEventStore/EventSourcing/GetEventStore.cs index 62886dc61..80503ad0a 100644 --- a/backend/src/Squidex.Infrastructure.GetEventStore/EventSourcing/GetEventStore.cs +++ b/backend/src/Squidex.Infrastructure.GetEventStore/EventSourcing/GetEventStore.cs @@ -29,8 +29,8 @@ namespace Squidex.Infrastructure.EventSourcing public GetEventStore(IEventStoreConnection connection, IJsonSerializer serializer, string prefix, string projectionHost) { - Guard.NotNull(connection); - Guard.NotNull(serializer); + Guard.NotNull(connection, nameof(connection)); + Guard.NotNull(serializer, nameof(serializer)); this.connection = connection; this.serializer = serializer; @@ -56,23 +56,23 @@ namespace Squidex.Infrastructure.EventSourcing public IEventSubscription CreateSubscription(IEventSubscriber subscriber, string? streamFilter = null, string? position = null) { - Guard.NotNull(streamFilter); + Guard.NotNull(streamFilter, nameof(streamFilter)); return new GetEventStoreSubscription(connection, subscriber, serializer, projectionClient, position, prefix, streamFilter); } public Task CreateIndexAsync(string property) { - Guard.NotNullOrEmpty(property); + Guard.NotNullOrEmpty(property, nameof(property)); return projectionClient.CreateProjectionAsync(property, string.Empty); } public async Task QueryAsync(Func callback, string property, object value, string? position = null, CancellationToken ct = default) { - Guard.NotNull(callback); - Guard.NotNullOrEmpty(property); - Guard.NotNull(value); + Guard.NotNull(callback, nameof(callback)); + Guard.NotNullOrEmpty(property, nameof(property)); + Guard.NotNull(value, nameof(value)); using (Profiler.TraceMethod()) { @@ -86,7 +86,7 @@ namespace Squidex.Infrastructure.EventSourcing public async Task QueryAsync(Func callback, string? streamFilter = null, string? position = null, CancellationToken ct = default) { - Guard.NotNull(callback); + Guard.NotNull(callback, nameof(callback)); using (Profiler.TraceMethod()) { @@ -122,7 +122,7 @@ namespace Squidex.Infrastructure.EventSourcing public async Task> QueryLatestAsync(string streamName, int count) { - Guard.NotNullOrEmpty(streamName); + Guard.NotNullOrEmpty(streamName, nameof(streamName)); if (count <= 0) { @@ -167,7 +167,7 @@ namespace Squidex.Infrastructure.EventSourcing public async Task> QueryAsync(string streamName, long streamPosition = 0) { - Guard.NotNullOrEmpty(streamName); + Guard.NotNullOrEmpty(streamName, nameof(streamName)); using (Profiler.TraceMethod()) { @@ -200,7 +200,7 @@ namespace Squidex.Infrastructure.EventSourcing public Task DeleteStreamAsync(string streamName) { - Guard.NotNullOrEmpty(streamName); + Guard.NotNullOrEmpty(streamName, nameof(streamName)); return connection.DeleteStreamAsync(GetStreamName(streamName), ExpectedVersion.Any); } @@ -212,15 +212,15 @@ namespace Squidex.Infrastructure.EventSourcing public Task AppendAsync(Guid commitId, string streamName, long expectedVersion, ICollection events) { - Guard.GreaterEquals(expectedVersion, -1); + Guard.GreaterEquals(expectedVersion, -1, nameof(expectedVersion)); return AppendEventsInternalAsync(streamName, expectedVersion, events); } private async Task AppendEventsInternalAsync(string streamName, long expectedVersion, ICollection events) { - Guard.NotNullOrEmpty(streamName); - Guard.NotNull(events); + Guard.NotNullOrEmpty(streamName, nameof(streamName)); + Guard.NotNull(events, nameof(events)); using (Profiler.TraceMethod(nameof(AppendAsync))) { diff --git a/backend/src/Squidex.Infrastructure.GoogleCloud/Assets/GoogleCloudAssetStore.cs b/backend/src/Squidex.Infrastructure.GoogleCloud/Assets/GoogleCloudAssetStore.cs index d2c69f8c9..b3356a1a2 100644 --- a/backend/src/Squidex.Infrastructure.GoogleCloud/Assets/GoogleCloudAssetStore.cs +++ b/backend/src/Squidex.Infrastructure.GoogleCloud/Assets/GoogleCloudAssetStore.cs @@ -25,7 +25,7 @@ namespace Squidex.Infrastructure.Assets public GoogleCloudAssetStore(string bucketName) { - Guard.NotNullOrEmpty(bucketName); + Guard.NotNullOrEmpty(bucketName, nameof(bucketName)); this.bucketName = bucketName; } @@ -51,7 +51,7 @@ namespace Squidex.Infrastructure.Assets public async Task GetSizeAsync(string fileName, CancellationToken ct = default) { - Guard.NotNullOrEmpty(fileName); + Guard.NotNullOrEmpty(fileName, nameof(fileName)); try { @@ -72,8 +72,8 @@ namespace Squidex.Infrastructure.Assets public async Task CopyAsync(string sourceFileName, string targetFileName, CancellationToken ct = default) { - Guard.NotNullOrEmpty(sourceFileName); - Guard.NotNullOrEmpty(targetFileName); + Guard.NotNullOrEmpty(sourceFileName, nameof(sourceFileName)); + Guard.NotNullOrEmpty(targetFileName, nameof(targetFileName)); try { @@ -91,7 +91,7 @@ namespace Squidex.Infrastructure.Assets public async Task DownloadAsync(string fileName, Stream stream, BytesRange range = default, CancellationToken ct = default) { - Guard.NotNullOrEmpty(fileName); + Guard.NotNullOrEmpty(fileName, nameof(fileName)); try { @@ -112,7 +112,7 @@ namespace Squidex.Infrastructure.Assets public async Task UploadAsync(string fileName, Stream stream, bool overwrite = false, CancellationToken ct = default) { - Guard.NotNullOrEmpty(fileName); + Guard.NotNullOrEmpty(fileName, nameof(fileName)); try { @@ -126,7 +126,7 @@ namespace Squidex.Infrastructure.Assets public async Task DeleteAsync(string fileName) { - Guard.NotNullOrEmpty(fileName); + Guard.NotNullOrEmpty(fileName, nameof(fileName)); try { diff --git a/backend/src/Squidex.Infrastructure.MongoDb/Assets/MongoGridFsAssetStore.cs b/backend/src/Squidex.Infrastructure.MongoDb/Assets/MongoGridFsAssetStore.cs index 8b9f21b58..55246eeca 100644 --- a/backend/src/Squidex.Infrastructure.MongoDb/Assets/MongoGridFsAssetStore.cs +++ b/backend/src/Squidex.Infrastructure.MongoDb/Assets/MongoGridFsAssetStore.cs @@ -23,7 +23,7 @@ namespace Squidex.Infrastructure.Assets public MongoGridFsAssetStore(IGridFSBucket bucket) { - Guard.NotNull(bucket); + Guard.NotNull(bucket, nameof(bucket)); this.bucket = bucket; } @@ -61,7 +61,7 @@ namespace Squidex.Infrastructure.Assets public async Task CopyAsync(string sourceFileName, string targetFileName, CancellationToken ct = default) { - Guard.NotNullOrEmpty(targetFileName); + Guard.NotNullOrEmpty(targetFileName, nameof(targetFileName)); try { @@ -80,7 +80,7 @@ namespace Squidex.Infrastructure.Assets public async Task DownloadAsync(string fileName, Stream stream, BytesRange range, CancellationToken ct = default) { - Guard.NotNull(stream); + Guard.NotNull(stream, nameof(stream)); try { @@ -101,7 +101,7 @@ namespace Squidex.Infrastructure.Assets public async Task UploadAsync(string fileName, Stream stream, bool overwrite = false, CancellationToken ct = default) { - Guard.NotNull(stream); + Guard.NotNull(stream, nameof(stream)); try { diff --git a/backend/src/Squidex.Infrastructure.MongoDb/Diagnostics/MongoDBHealthCheck.cs b/backend/src/Squidex.Infrastructure.MongoDb/Diagnostics/MongoDBHealthCheck.cs index 1f200b961..3ca573dda 100644 --- a/backend/src/Squidex.Infrastructure.MongoDb/Diagnostics/MongoDBHealthCheck.cs +++ b/backend/src/Squidex.Infrastructure.MongoDb/Diagnostics/MongoDBHealthCheck.cs @@ -18,7 +18,7 @@ namespace Squidex.Infrastructure.Diagnostics public MongoDBHealthCheck(IMongoDatabase mongoDatabase) { - Guard.NotNull(mongoDatabase); + Guard.NotNull(mongoDatabase, nameof(mongoDatabase)); this.mongoDatabase = mongoDatabase; } diff --git a/backend/src/Squidex.Infrastructure.MongoDb/EventSourcing/MongoEventStore.cs b/backend/src/Squidex.Infrastructure.MongoDb/EventSourcing/MongoEventStore.cs index b4e630159..37a512134 100644 --- a/backend/src/Squidex.Infrastructure.MongoDb/EventSourcing/MongoEventStore.cs +++ b/backend/src/Squidex.Infrastructure.MongoDb/EventSourcing/MongoEventStore.cs @@ -29,7 +29,7 @@ namespace Squidex.Infrastructure.EventSourcing public MongoEventStore(IMongoDatabase database, IEventNotifier notifier) : base(database) { - Guard.NotNull(notifier); + Guard.NotNull(notifier, nameof(notifier)); this.notifier = notifier; } diff --git a/backend/src/Squidex.Infrastructure.MongoDb/EventSourcing/MongoEventStore_Reader.cs b/backend/src/Squidex.Infrastructure.MongoDb/EventSourcing/MongoEventStore_Reader.cs index bca3488c1..191ca742d 100644 --- a/backend/src/Squidex.Infrastructure.MongoDb/EventSourcing/MongoEventStore_Reader.cs +++ b/backend/src/Squidex.Infrastructure.MongoDb/EventSourcing/MongoEventStore_Reader.cs @@ -26,7 +26,7 @@ namespace Squidex.Infrastructure.EventSourcing public Task CreateIndexAsync(string property) { - Guard.NotNullOrEmpty(property); + Guard.NotNullOrEmpty(property, nameof(property)); return Collection.Indexes.CreateOneAsync( new CreateIndexModel( @@ -37,14 +37,14 @@ namespace Squidex.Infrastructure.EventSourcing public IEventSubscription CreateSubscription(IEventSubscriber subscriber, string? streamFilter = null, string? position = null) { - Guard.NotNull(subscriber); + Guard.NotNull(subscriber, nameof(subscriber)); return new PollingSubscription(this, subscriber, streamFilter, position); } public async Task> QueryLatestAsync(string streamName, int count) { - Guard.NotNullOrEmpty(streamName); + Guard.NotNullOrEmpty(streamName, nameof(streamName)); if (count <= 0) { @@ -91,7 +91,7 @@ namespace Squidex.Infrastructure.EventSourcing public async Task> QueryAsync(string streamName, long streamPosition = 0) { - Guard.NotNullOrEmpty(streamName); + Guard.NotNullOrEmpty(streamName, nameof(streamName)); using (Profiler.TraceMethod()) { @@ -131,9 +131,9 @@ namespace Squidex.Infrastructure.EventSourcing public Task QueryAsync(Func callback, string property, object value, string? position = null, CancellationToken ct = default) { - Guard.NotNull(callback); - Guard.NotNullOrEmpty(property); - Guard.NotNull(value); + Guard.NotNull(callback, nameof(callback)); + Guard.NotNullOrEmpty(property, nameof(property)); + Guard.NotNull(value, nameof(value)); StreamPosition lastPosition = position; @@ -145,7 +145,7 @@ namespace Squidex.Infrastructure.EventSourcing public Task QueryAsync(Func callback, string? streamFilter = null, string? position = null, CancellationToken ct = default) { - Guard.NotNull(callback); + Guard.NotNull(callback, nameof(callback)); StreamPosition lastPosition = position; diff --git a/backend/src/Squidex.Infrastructure.MongoDb/EventSourcing/MongoEventStore_Writer.cs b/backend/src/Squidex.Infrastructure.MongoDb/EventSourcing/MongoEventStore_Writer.cs index 81910f65e..525414278 100644 --- a/backend/src/Squidex.Infrastructure.MongoDb/EventSourcing/MongoEventStore_Writer.cs +++ b/backend/src/Squidex.Infrastructure.MongoDb/EventSourcing/MongoEventStore_Writer.cs @@ -22,7 +22,7 @@ namespace Squidex.Infrastructure.EventSourcing public Task DeleteStreamAsync(string streamName) { - Guard.NotNullOrEmpty(streamName); + Guard.NotNullOrEmpty(streamName, nameof(streamName)); return Collection.DeleteManyAsync(x => x.EventStream == streamName); } @@ -34,13 +34,13 @@ namespace Squidex.Infrastructure.EventSourcing public async Task AppendAsync(Guid commitId, string streamName, long expectedVersion, ICollection events) { - Guard.NotEmpty(commitId); - Guard.NotNullOrEmpty(streamName); - Guard.NotNull(events); - Guard.NotNullOrEmpty(streamName); - Guard.NotNull(events); + Guard.NotEmpty(commitId, nameof(commitId)); + Guard.NotNullOrEmpty(streamName, nameof(streamName)); + Guard.NotNull(events, nameof(events)); + Guard.NotNullOrEmpty(streamName, nameof(streamName)); + Guard.NotNull(events, nameof(events)); Guard.LessThan(events.Count, MaxCommitSize, "events.Count"); - Guard.GreaterEquals(expectedVersion, EtagVersion.Any); + Guard.GreaterEquals(expectedVersion, EtagVersion.Any, nameof(expectedVersion)); using (Profiler.TraceMethod()) { diff --git a/backend/src/Squidex.Infrastructure.MongoDb/Log/MongoRequestLogRepository.cs b/backend/src/Squidex.Infrastructure.MongoDb/Log/MongoRequestLogRepository.cs index 43441bb0c..6722900eb 100644 --- a/backend/src/Squidex.Infrastructure.MongoDb/Log/MongoRequestLogRepository.cs +++ b/backend/src/Squidex.Infrastructure.MongoDb/Log/MongoRequestLogRepository.cs @@ -26,7 +26,7 @@ namespace Squidex.Infrastructure.Log public MongoRequestLogRepository(IMongoDatabase database, IOptions options) : base(database) { - Guard.NotNull(options); + Guard.NotNull(options, nameof(options)); this.options = options.Value; } @@ -56,7 +56,7 @@ namespace Squidex.Infrastructure.Log public Task InsertManyAsync(IEnumerable items) { - Guard.NotNull(items); + Guard.NotNull(items, nameof(items)); var documents = items.Select(x => new MongoRequest { Key = x.Key, Timestamp = x.Timestamp, Properties = x.Properties }); @@ -65,8 +65,8 @@ namespace Squidex.Infrastructure.Log public Task QueryAllAsync(Func callback, string key, DateTime fromDate, DateTime toDate, CancellationToken ct = default) { - Guard.NotNull(callback); - Guard.NotNullOrEmpty(key); + Guard.NotNull(callback, nameof(callback)); + Guard.NotNullOrEmpty(key, nameof(key)); var timestampStart = Instant.FromDateTimeUtc(fromDate); var timestampEnd = Instant.FromDateTimeUtc(toDate.AddDays(1)); diff --git a/backend/src/Squidex.Infrastructure.MongoDb/MongoDb/BsonJsonReader.cs b/backend/src/Squidex.Infrastructure.MongoDb/MongoDb/BsonJsonReader.cs index 87657127b..f801aeddc 100644 --- a/backend/src/Squidex.Infrastructure.MongoDb/MongoDb/BsonJsonReader.cs +++ b/backend/src/Squidex.Infrastructure.MongoDb/MongoDb/BsonJsonReader.cs @@ -19,7 +19,7 @@ namespace Squidex.Infrastructure.MongoDb public BsonJsonReader(IBsonReader bsonReader) { - Guard.NotNull(bsonReader); + Guard.NotNull(bsonReader, nameof(bsonReader)); this.bsonReader = bsonReader; } diff --git a/backend/src/Squidex.Infrastructure.MongoDb/MongoDb/BsonJsonSerializer.cs b/backend/src/Squidex.Infrastructure.MongoDb/MongoDb/BsonJsonSerializer.cs index f5896212f..f80d853fd 100644 --- a/backend/src/Squidex.Infrastructure.MongoDb/MongoDb/BsonJsonSerializer.cs +++ b/backend/src/Squidex.Infrastructure.MongoDb/MongoDb/BsonJsonSerializer.cs @@ -18,7 +18,7 @@ namespace Squidex.Infrastructure.MongoDb public BsonJsonSerializer(JsonSerializer serializer) { - Guard.NotNull(serializer); + Guard.NotNull(serializer, nameof(serializer)); this.serializer = serializer; } diff --git a/backend/src/Squidex.Infrastructure.MongoDb/MongoDb/BsonJsonWriter.cs b/backend/src/Squidex.Infrastructure.MongoDb/MongoDb/BsonJsonWriter.cs index b9bc639f4..6a02a00b4 100644 --- a/backend/src/Squidex.Infrastructure.MongoDb/MongoDb/BsonJsonWriter.cs +++ b/backend/src/Squidex.Infrastructure.MongoDb/MongoDb/BsonJsonWriter.cs @@ -17,7 +17,7 @@ namespace Squidex.Infrastructure.MongoDb public BsonJsonWriter(IBsonWriter bsonWriter) { - Guard.NotNull(bsonWriter); + Guard.NotNull(bsonWriter, nameof(bsonWriter)); this.bsonWriter = bsonWriter; } diff --git a/backend/src/Squidex.Infrastructure.MongoDb/MongoDb/MongoRepositoryBase.cs b/backend/src/Squidex.Infrastructure.MongoDb/MongoDb/MongoRepositoryBase.cs index 3d7a48bd3..8ca268545 100644 --- a/backend/src/Squidex.Infrastructure.MongoDb/MongoDb/MongoRepositoryBase.cs +++ b/backend/src/Squidex.Infrastructure.MongoDb/MongoDb/MongoRepositoryBase.cs @@ -58,7 +58,7 @@ namespace Squidex.Infrastructure.MongoDb protected MongoRepositoryBase(IMongoDatabase database, bool setup = false) { - Guard.NotNull(database); + Guard.NotNull(database, nameof(database)); mongoDatabase = database; diff --git a/backend/src/Squidex.Infrastructure.MongoDb/States/MongoSnapshotStore.cs b/backend/src/Squidex.Infrastructure.MongoDb/States/MongoSnapshotStore.cs index 351dea3c1..d235d7d85 100644 --- a/backend/src/Squidex.Infrastructure.MongoDb/States/MongoSnapshotStore.cs +++ b/backend/src/Squidex.Infrastructure.MongoDb/States/MongoSnapshotStore.cs @@ -26,7 +26,7 @@ namespace Squidex.Infrastructure.States private static bool Register(JsonSerializer jsonSerializer) { - Guard.NotNull(jsonSerializer); + Guard.NotNull(jsonSerializer, nameof(jsonSerializer)); BsonJsonConvention.Register(jsonSerializer); diff --git a/backend/src/Squidex.Infrastructure.MongoDb/UsageTracking/MongoUsageRepository.cs b/backend/src/Squidex.Infrastructure.MongoDb/UsageTracking/MongoUsageRepository.cs index a606be19e..3242cb2a7 100644 --- a/backend/src/Squidex.Infrastructure.MongoDb/UsageTracking/MongoUsageRepository.cs +++ b/backend/src/Squidex.Infrastructure.MongoDb/UsageTracking/MongoUsageRepository.cs @@ -42,7 +42,7 @@ namespace Squidex.Infrastructure.UsageTracking public async Task TrackUsagesAsync(UsageUpdate update) { - Guard.NotNull(update); + Guard.NotNull(update, nameof(update)); if (update.Counters.Count > 0) { diff --git a/backend/src/Squidex.Infrastructure.RabbitMq/CQRS/Events/RabbitMqEventConsumer.cs b/backend/src/Squidex.Infrastructure.RabbitMq/CQRS/Events/RabbitMqEventConsumer.cs index cbfa6229a..4075f8dc1 100644 --- a/backend/src/Squidex.Infrastructure.RabbitMq/CQRS/Events/RabbitMqEventConsumer.cs +++ b/backend/src/Squidex.Infrastructure.RabbitMq/CQRS/Events/RabbitMqEventConsumer.cs @@ -37,10 +37,10 @@ namespace Squidex.Infrastructure.CQRS.Events public RabbitMqEventConsumer(IJsonSerializer jsonSerializer, string eventPublisherName, string uri, string exchange, string eventsFilter) { - Guard.NotNullOrEmpty(uri); - Guard.NotNullOrEmpty(eventPublisherName); - Guard.NotNullOrEmpty(exchange); - Guard.NotNull(jsonSerializer); + Guard.NotNullOrEmpty(uri, nameof(uri)); + Guard.NotNullOrEmpty(eventPublisherName, nameof(eventPublisherName)); + Guard.NotNullOrEmpty(exchange, nameof(exchange)); + Guard.NotNull(jsonSerializer, nameof(jsonSerializer)); connectionFactory = new ConnectionFactory { Uri = new Uri(uri, UriKind.Absolute) }; connection = new Lazy(connectionFactory.CreateConnection); diff --git a/backend/src/Squidex.Infrastructure/Assets/AssetAlreadyExistsException.cs b/backend/src/Squidex.Infrastructure/Assets/AssetAlreadyExistsException.cs index 1ab0d2964..ddf8465e0 100644 --- a/backend/src/Squidex.Infrastructure/Assets/AssetAlreadyExistsException.cs +++ b/backend/src/Squidex.Infrastructure/Assets/AssetAlreadyExistsException.cs @@ -30,7 +30,7 @@ namespace Squidex.Infrastructure.Assets private static string FormatMessage(string fileName) { - Guard.NotNullOrEmpty(fileName); + Guard.NotNullOrEmpty(fileName, nameof(fileName)); return $"An asset with name '{fileName}' already exists."; } diff --git a/backend/src/Squidex.Infrastructure/Assets/AssetFile.cs b/backend/src/Squidex.Infrastructure/Assets/AssetFile.cs index 9f5a9aff3..4f5ef010f 100644 --- a/backend/src/Squidex.Infrastructure/Assets/AssetFile.cs +++ b/backend/src/Squidex.Infrastructure/Assets/AssetFile.cs @@ -22,9 +22,9 @@ namespace Squidex.Infrastructure.Assets public AssetFile(string fileName, string mimeType, long fileSize, Func openAction) { - Guard.NotNullOrEmpty(fileName); - Guard.NotNullOrEmpty(mimeType); - Guard.GreaterEquals(fileSize, 0); + Guard.NotNullOrEmpty(fileName, nameof(fileName)); + Guard.NotNullOrEmpty(mimeType, nameof(mimeType)); + Guard.GreaterEquals(fileSize, 0, nameof(fileSize)); FileName = fileName; FileSize = fileSize; diff --git a/backend/src/Squidex.Infrastructure/Assets/AssetNotFoundException.cs b/backend/src/Squidex.Infrastructure/Assets/AssetNotFoundException.cs index 7883a56b9..1691a8bbf 100644 --- a/backend/src/Squidex.Infrastructure/Assets/AssetNotFoundException.cs +++ b/backend/src/Squidex.Infrastructure/Assets/AssetNotFoundException.cs @@ -30,7 +30,7 @@ namespace Squidex.Infrastructure.Assets private static string FormatMessage(string fileName) { - Guard.NotNullOrEmpty(fileName); + Guard.NotNullOrEmpty(fileName, nameof(fileName)); return $"An asset with name '{fileName}' does not exist."; } diff --git a/backend/src/Squidex.Infrastructure/Assets/FTPAssetStore.cs b/backend/src/Squidex.Infrastructure/Assets/FTPAssetStore.cs index 66821ed9b..01caddf69 100644 --- a/backend/src/Squidex.Infrastructure/Assets/FTPAssetStore.cs +++ b/backend/src/Squidex.Infrastructure/Assets/FTPAssetStore.cs @@ -24,9 +24,9 @@ namespace Squidex.Infrastructure.Assets public FTPAssetStore(Func factory, string path, ISemanticLog log) { - Guard.NotNull(factory); - Guard.NotNullOrEmpty(path); - Guard.NotNull(log); + Guard.NotNull(factory, nameof(factory)); + Guard.NotNullOrEmpty(path, nameof(path)); + Guard.NotNull(log, nameof(log)); this.factory = factory; this.path = path; @@ -58,7 +58,7 @@ namespace Squidex.Infrastructure.Assets public async Task GetSizeAsync(string fileName, CancellationToken ct = default) { - Guard.NotNullOrEmpty(fileName); + Guard.NotNullOrEmpty(fileName, nameof(fileName)); using (var client = GetFtpClient()) { @@ -82,8 +82,8 @@ namespace Squidex.Infrastructure.Assets public async Task CopyAsync(string sourceFileName, string targetFileName, CancellationToken ct = default) { - Guard.NotNullOrEmpty(sourceFileName); - Guard.NotNullOrEmpty(targetFileName); + Guard.NotNullOrEmpty(sourceFileName, nameof(sourceFileName)); + Guard.NotNullOrEmpty(targetFileName, nameof(targetFileName)); using (var client = GetFtpClient()) { @@ -112,8 +112,8 @@ namespace Squidex.Infrastructure.Assets public async Task DownloadAsync(string fileName, Stream stream, BytesRange range = default, CancellationToken ct = default) { - Guard.NotNullOrEmpty(fileName); - Guard.NotNull(stream); + Guard.NotNullOrEmpty(fileName, nameof(fileName)); + Guard.NotNull(stream, nameof(stream)); using (var client = GetFtpClient()) { @@ -133,8 +133,8 @@ namespace Squidex.Infrastructure.Assets public async Task UploadAsync(string fileName, Stream stream, bool overwrite = false, CancellationToken ct = default) { - Guard.NotNullOrEmpty(fileName); - Guard.NotNull(stream); + Guard.NotNullOrEmpty(fileName, nameof(fileName)); + Guard.NotNull(stream, nameof(stream)); using (var client = GetFtpClient()) { @@ -156,7 +156,7 @@ namespace Squidex.Infrastructure.Assets public async Task DeleteAsync(string fileName) { - Guard.NotNullOrEmpty(fileName); + Guard.NotNullOrEmpty(fileName, nameof(fileName)); using (var client = GetFtpClient()) { diff --git a/backend/src/Squidex.Infrastructure/Assets/FolderAssetStore.cs b/backend/src/Squidex.Infrastructure/Assets/FolderAssetStore.cs index 68861548b..184f7fbea 100644 --- a/backend/src/Squidex.Infrastructure/Assets/FolderAssetStore.cs +++ b/backend/src/Squidex.Infrastructure/Assets/FolderAssetStore.cs @@ -21,8 +21,8 @@ namespace Squidex.Infrastructure.Assets public FolderAssetStore(string path, ISemanticLog log) { - Guard.NotNullOrEmpty(path); - Guard.NotNull(log); + Guard.NotNullOrEmpty(path, nameof(path)); + Guard.NotNull(log, nameof(log)); this.log = log; @@ -92,7 +92,7 @@ namespace Squidex.Infrastructure.Assets public async Task DownloadAsync(string fileName, Stream stream, BytesRange range, CancellationToken ct = default) { - Guard.NotNull(stream); + Guard.NotNull(stream, nameof(stream)); var file = GetFile(fileName, nameof(fileName)); @@ -111,7 +111,7 @@ namespace Squidex.Infrastructure.Assets public async Task UploadAsync(string fileName, Stream stream, bool overwrite = false, CancellationToken ct = default) { - Guard.NotNull(stream); + Guard.NotNull(stream, nameof(stream)); var file = GetFile(fileName, nameof(fileName)); diff --git a/backend/src/Squidex.Infrastructure/Assets/HasherStream.cs b/backend/src/Squidex.Infrastructure/Assets/HasherStream.cs index 40b366ffd..dd7594990 100644 --- a/backend/src/Squidex.Infrastructure/Assets/HasherStream.cs +++ b/backend/src/Squidex.Infrastructure/Assets/HasherStream.cs @@ -44,7 +44,7 @@ namespace Squidex.Infrastructure.Assets public HasherStream(Stream inner, HashAlgorithmName hashAlgorithmName) { - Guard.NotNull(inner); + Guard.NotNull(inner, nameof(inner)); if (!inner.CanRead) { diff --git a/backend/src/Squidex.Infrastructure/Assets/ImageInfo.cs b/backend/src/Squidex.Infrastructure/Assets/ImageInfo.cs index 707aac23b..2b3114cf3 100644 --- a/backend/src/Squidex.Infrastructure/Assets/ImageInfo.cs +++ b/backend/src/Squidex.Infrastructure/Assets/ImageInfo.cs @@ -15,8 +15,8 @@ namespace Squidex.Infrastructure.Assets public ImageInfo(int pixelWidth, int pixelHeight) { - Guard.GreaterThan(pixelWidth, 0); - Guard.GreaterThan(pixelHeight, 0); + Guard.GreaterThan(pixelWidth, 0, nameof(pixelWidth)); + Guard.GreaterThan(pixelHeight, 0, nameof(pixelHeight)); PixelWidth = pixelWidth; PixelHeight = pixelHeight; diff --git a/backend/src/Squidex.Infrastructure/Assets/ImageSharp/ImageSharpAssetThumbnailGenerator.cs b/backend/src/Squidex.Infrastructure/Assets/ImageSharp/ImageSharpAssetThumbnailGenerator.cs index b2334f224..7b900a840 100644 --- a/backend/src/Squidex.Infrastructure/Assets/ImageSharp/ImageSharpAssetThumbnailGenerator.cs +++ b/backend/src/Squidex.Infrastructure/Assets/ImageSharp/ImageSharpAssetThumbnailGenerator.cs @@ -21,7 +21,7 @@ namespace Squidex.Infrastructure.Assets.ImageSharp { public Task CreateThumbnailAsync(Stream source, Stream destination, ResizeOptions options) { - Guard.NotNull(options); + Guard.NotNull(options, nameof(options)); return Task.Run(() => { diff --git a/backend/src/Squidex.Infrastructure/Assets/MemoryAssetStore.cs b/backend/src/Squidex.Infrastructure/Assets/MemoryAssetStore.cs index 8c92ffbae..62fcd9c56 100644 --- a/backend/src/Squidex.Infrastructure/Assets/MemoryAssetStore.cs +++ b/backend/src/Squidex.Infrastructure/Assets/MemoryAssetStore.cs @@ -26,7 +26,7 @@ namespace Squidex.Infrastructure.Assets public async Task GetSizeAsync(string fileName, CancellationToken ct = default) { - Guard.NotNullOrEmpty(fileName); + Guard.NotNullOrEmpty(fileName, nameof(fileName)); if (!streams.TryGetValue(fileName, out var sourceStream)) { @@ -41,8 +41,8 @@ namespace Squidex.Infrastructure.Assets public virtual async Task CopyAsync(string sourceFileName, string targetFileName, CancellationToken ct = default) { - Guard.NotNullOrEmpty(sourceFileName); - Guard.NotNullOrEmpty(targetFileName); + Guard.NotNullOrEmpty(sourceFileName, nameof(sourceFileName)); + Guard.NotNullOrEmpty(targetFileName, nameof(targetFileName)); if (!streams.TryGetValue(sourceFileName, out var sourceStream)) { @@ -57,8 +57,8 @@ namespace Squidex.Infrastructure.Assets public virtual async Task DownloadAsync(string fileName, Stream stream, BytesRange range = default, CancellationToken ct = default) { - Guard.NotNullOrEmpty(fileName); - Guard.NotNull(stream); + Guard.NotNullOrEmpty(fileName, nameof(fileName)); + Guard.NotNull(stream, nameof(stream)); if (!streams.TryGetValue(fileName, out var sourceStream)) { @@ -80,8 +80,8 @@ namespace Squidex.Infrastructure.Assets public virtual async Task UploadAsync(string fileName, Stream stream, bool overwrite = false, CancellationToken ct = default) { - Guard.NotNullOrEmpty(fileName); - Guard.NotNull(stream); + Guard.NotNullOrEmpty(fileName, nameof(fileName)); + Guard.NotNull(stream, nameof(stream)); var memoryStream = new MemoryStream(); @@ -118,7 +118,7 @@ namespace Squidex.Infrastructure.Assets public virtual Task DeleteAsync(string fileName) { - Guard.NotNullOrEmpty(fileName); + Guard.NotNullOrEmpty(fileName, nameof(fileName)); streams.TryRemove(fileName, out _); diff --git a/backend/src/Squidex.Infrastructure/Caching/CachingProviderBase.cs b/backend/src/Squidex.Infrastructure/Caching/CachingProviderBase.cs index b1248a6a2..9ff773e51 100644 --- a/backend/src/Squidex.Infrastructure/Caching/CachingProviderBase.cs +++ b/backend/src/Squidex.Infrastructure/Caching/CachingProviderBase.cs @@ -20,7 +20,7 @@ namespace Squidex.Infrastructure.Caching protected CachingProviderBase(IMemoryCache cache) { - Guard.NotNull(cache); + Guard.NotNull(cache, nameof(cache)); this.cache = cache; } diff --git a/backend/src/Squidex.Infrastructure/Caching/LRUCache.cs b/backend/src/Squidex.Infrastructure/Caching/LRUCache.cs index 985d884e9..de4de831f 100644 --- a/backend/src/Squidex.Infrastructure/Caching/LRUCache.cs +++ b/backend/src/Squidex.Infrastructure/Caching/LRUCache.cs @@ -20,7 +20,7 @@ namespace Squidex.Infrastructure.Caching public LRUCache(int capacity, Action? itemEvicted = null) { - Guard.GreaterThan(capacity, 0); + Guard.GreaterThan(capacity, 0, nameof(capacity)); this.capacity = capacity; diff --git a/backend/src/Squidex.Infrastructure/CollectionExtensions.cs b/backend/src/Squidex.Infrastructure/CollectionExtensions.cs index 6f4c32193..f4be61d44 100644 --- a/backend/src/Squidex.Infrastructure/CollectionExtensions.cs +++ b/backend/src/Squidex.Infrastructure/CollectionExtensions.cs @@ -129,7 +129,7 @@ namespace Squidex.Infrastructure public static int OrderedHashCode(this IEnumerable collection, IEqualityComparer comparer) where T : notnull { - Guard.NotNull(comparer); + Guard.NotNull(comparer, nameof(comparer)); var hashCodes = collection.Where(x => !Equals(x, null)).Select(x => x.GetHashCode()).OrderBy(x => x).ToArray(); diff --git a/backend/src/Squidex.Infrastructure/Collections/ImmutableDictionary{TKey,TValue}.cs b/backend/src/Squidex.Infrastructure/Collections/ImmutableDictionary{TKey,TValue}.cs index a7458eddf..7b7394fce 100644 --- a/backend/src/Squidex.Infrastructure/Collections/ImmutableDictionary{TKey,TValue}.cs +++ b/backend/src/Squidex.Infrastructure/Collections/ImmutableDictionary{TKey,TValue}.cs @@ -54,7 +54,7 @@ namespace Squidex.Infrastructure.Collections public ImmutableDictionary(Dictionary inner) { - Guard.NotNull(inner); + Guard.NotNull(inner, nameof(inner)); this.inner = inner; } diff --git a/backend/src/Squidex.Infrastructure/Commands/CommandContext.cs b/backend/src/Squidex.Infrastructure/Commands/CommandContext.cs index ccc82b13c..d7ec30710 100644 --- a/backend/src/Squidex.Infrastructure/Commands/CommandContext.cs +++ b/backend/src/Squidex.Infrastructure/Commands/CommandContext.cs @@ -31,8 +31,8 @@ namespace Squidex.Infrastructure.Commands public CommandContext(ICommand command, ICommandBus commandBus) { - Guard.NotNull(command); - Guard.NotNull(commandBus); + Guard.NotNull(command, nameof(command)); + Guard.NotNull(commandBus, nameof(commandBus)); Command = command; CommandBus = commandBus; diff --git a/backend/src/Squidex.Infrastructure/Commands/CustomCommandMiddlewareRunner.cs b/backend/src/Squidex.Infrastructure/Commands/CustomCommandMiddlewareRunner.cs index c6b42919d..7375e871b 100644 --- a/backend/src/Squidex.Infrastructure/Commands/CustomCommandMiddlewareRunner.cs +++ b/backend/src/Squidex.Infrastructure/Commands/CustomCommandMiddlewareRunner.cs @@ -17,7 +17,7 @@ namespace Squidex.Infrastructure.Commands public CustomCommandMiddlewareRunner(IEnumerable extensions) { - Guard.NotNull(extensions); + Guard.NotNull(extensions, nameof(extensions)); this.extensions = extensions.Reverse().ToList(); } diff --git a/backend/src/Squidex.Infrastructure/Commands/DomainObject.cs b/backend/src/Squidex.Infrastructure/Commands/DomainObject.cs index d3b0a03e6..c83bd6d5f 100644 --- a/backend/src/Squidex.Infrastructure/Commands/DomainObject.cs +++ b/backend/src/Squidex.Infrastructure/Commands/DomainObject.cs @@ -27,7 +27,7 @@ namespace Squidex.Infrastructure.Commands protected DomainObject(IStore store, ISemanticLog log) : base(log) { - Guard.NotNull(store); + Guard.NotNull(store, nameof(store)); this.store = store; } diff --git a/backend/src/Squidex.Infrastructure/Commands/DomainObjectBase.cs b/backend/src/Squidex.Infrastructure/Commands/DomainObjectBase.cs index 52e0dbaa5..07e6670c0 100644 --- a/backend/src/Squidex.Infrastructure/Commands/DomainObjectBase.cs +++ b/backend/src/Squidex.Infrastructure/Commands/DomainObjectBase.cs @@ -35,7 +35,7 @@ namespace Squidex.Infrastructure.Commands protected DomainObjectBase(ISemanticLog log) { - Guard.NotNull(log); + Guard.NotNull(log, nameof(log)); this.log = log; } @@ -81,7 +81,7 @@ namespace Squidex.Infrastructure.Commands protected virtual void RaiseEvent(Envelope @event) { - Guard.NotNull(@event); + Guard.NotNull(@event, nameof(@event)); @event.SetAggregateId(id); @@ -143,8 +143,8 @@ namespace Squidex.Infrastructure.Commands private async Task InvokeAsync(TCommand command, Func> handler, bool isUpdate) where TCommand : class, IAggregateCommand { - Guard.NotNull(command); - Guard.NotNull(handler); + Guard.NotNull(command, nameof(command)); + Guard.NotNull(handler, nameof(handler)); if (isUpdate) { diff --git a/backend/src/Squidex.Infrastructure/Commands/DomainObjectGrain.cs b/backend/src/Squidex.Infrastructure/Commands/DomainObjectGrain.cs index 7152aeb87..d475d02da 100644 --- a/backend/src/Squidex.Infrastructure/Commands/DomainObjectGrain.cs +++ b/backend/src/Squidex.Infrastructure/Commands/DomainObjectGrain.cs @@ -28,7 +28,7 @@ namespace Squidex.Infrastructure.Commands protected DomainObjectGrain(IServiceProvider serviceProvider) { - Guard.NotNull(serviceProvider); + Guard.NotNull(serviceProvider, nameof(serviceProvider)); domainObject = serviceProvider.GetRequiredService(); } diff --git a/backend/src/Squidex.Infrastructure/Commands/EnrichWithTimestampCommandMiddleware.cs b/backend/src/Squidex.Infrastructure/Commands/EnrichWithTimestampCommandMiddleware.cs index af49eebe5..b45c48ece 100644 --- a/backend/src/Squidex.Infrastructure/Commands/EnrichWithTimestampCommandMiddleware.cs +++ b/backend/src/Squidex.Infrastructure/Commands/EnrichWithTimestampCommandMiddleware.cs @@ -16,7 +16,7 @@ namespace Squidex.Infrastructure.Commands public EnrichWithTimestampCommandMiddleware(IClock clock) { - Guard.NotNull(clock); + Guard.NotNull(clock, nameof(clock)); this.clock = clock; } diff --git a/backend/src/Squidex.Infrastructure/Commands/GrainCommandMiddleware.cs b/backend/src/Squidex.Infrastructure/Commands/GrainCommandMiddleware.cs index 90588ab85..8b49b1683 100644 --- a/backend/src/Squidex.Infrastructure/Commands/GrainCommandMiddleware.cs +++ b/backend/src/Squidex.Infrastructure/Commands/GrainCommandMiddleware.cs @@ -16,7 +16,7 @@ namespace Squidex.Infrastructure.Commands public GrainCommandMiddleware(IGrainFactory grainFactory) { - Guard.NotNull(grainFactory); + Guard.NotNull(grainFactory, nameof(grainFactory)); this.grainFactory = grainFactory; } diff --git a/backend/src/Squidex.Infrastructure/Commands/InMemoryCommandBus.cs b/backend/src/Squidex.Infrastructure/Commands/InMemoryCommandBus.cs index 286d70b99..8f4811800 100644 --- a/backend/src/Squidex.Infrastructure/Commands/InMemoryCommandBus.cs +++ b/backend/src/Squidex.Infrastructure/Commands/InMemoryCommandBus.cs @@ -48,7 +48,7 @@ namespace Squidex.Infrastructure.Commands public InMemoryCommandBus(IEnumerable middlewares) { - Guard.NotNull(middlewares); + Guard.NotNull(middlewares, nameof(middlewares)); var reverseMiddlewares = middlewares.Reverse().ToList(); @@ -64,7 +64,7 @@ namespace Squidex.Infrastructure.Commands public async Task PublishAsync(ICommand command) { - Guard.NotNull(command); + Guard.NotNull(command, nameof(command)); var context = new CommandContext(command, this); diff --git a/backend/src/Squidex.Infrastructure/Commands/LogCommandMiddleware.cs b/backend/src/Squidex.Infrastructure/Commands/LogCommandMiddleware.cs index 4ebfa279f..2cafbb024 100644 --- a/backend/src/Squidex.Infrastructure/Commands/LogCommandMiddleware.cs +++ b/backend/src/Squidex.Infrastructure/Commands/LogCommandMiddleware.cs @@ -17,7 +17,7 @@ namespace Squidex.Infrastructure.Commands public LogCommandMiddleware(ISemanticLog log) { - Guard.NotNull(log); + Guard.NotNull(log, nameof(log)); this.log = log; } diff --git a/backend/src/Squidex.Infrastructure/Commands/LogSnapshotDomainObject.cs b/backend/src/Squidex.Infrastructure/Commands/LogSnapshotDomainObject.cs index 803e09df3..5809a0d30 100644 --- a/backend/src/Squidex.Infrastructure/Commands/LogSnapshotDomainObject.cs +++ b/backend/src/Squidex.Infrastructure/Commands/LogSnapshotDomainObject.cs @@ -29,7 +29,7 @@ namespace Squidex.Infrastructure.Commands protected LogSnapshotDomainObject(IStore store, ISemanticLog log) : base(log) { - Guard.NotNull(log); + Guard.NotNull(log, nameof(log)); this.store = store; } diff --git a/backend/src/Squidex.Infrastructure/Commands/ReadonlyCommandMiddleware.cs b/backend/src/Squidex.Infrastructure/Commands/ReadonlyCommandMiddleware.cs index 9e0f3bf95..2a51820cf 100644 --- a/backend/src/Squidex.Infrastructure/Commands/ReadonlyCommandMiddleware.cs +++ b/backend/src/Squidex.Infrastructure/Commands/ReadonlyCommandMiddleware.cs @@ -16,7 +16,7 @@ namespace Squidex.Infrastructure.Commands public ReadonlyCommandMiddleware(IOptions options) { - Guard.NotNull(options); + Guard.NotNull(options, nameof(options)); this.options = options.Value; } diff --git a/backend/src/Squidex.Infrastructure/Commands/Rebuilder.cs b/backend/src/Squidex.Infrastructure/Commands/Rebuilder.cs index 4a8290d41..433afcd60 100644 --- a/backend/src/Squidex.Infrastructure/Commands/Rebuilder.cs +++ b/backend/src/Squidex.Infrastructure/Commands/Rebuilder.cs @@ -31,9 +31,9 @@ namespace Squidex.Infrastructure.Commands IEventStore eventStore, IServiceProvider serviceProvider) { - Guard.NotNull(localCache); - Guard.NotNull(store); - Guard.NotNull(eventStore); + Guard.NotNull(localCache, nameof(localCache)); + Guard.NotNull(store, nameof(store)); + Guard.NotNull(eventStore, nameof(eventStore)); this.eventStore = eventStore; this.serviceProvider = serviceProvider; @@ -56,7 +56,7 @@ namespace Squidex.Infrastructure.Commands public virtual async Task RebuildAsync(IdSource source, CancellationToken ct = default) where T : DomainObjectBase where TState : class, IDomainState, new() { - Guard.NotNull(source); + Guard.NotNull(source, nameof(source)); await store.GetSnapshotStore().ClearAsync(); @@ -65,7 +65,7 @@ namespace Squidex.Infrastructure.Commands public virtual async Task InsertManyAsync(IdSource source, CancellationToken ct = default) where T : DomainObjectBase where TState : class, IDomainState, new() { - Guard.NotNull(source); + Guard.NotNull(source, nameof(source)); var worker = new ActionBlock(async id => { diff --git a/backend/src/Squidex.Infrastructure/DelegateDisposable.cs b/backend/src/Squidex.Infrastructure/DelegateDisposable.cs index f24bd2913..bbdbb0262 100644 --- a/backend/src/Squidex.Infrastructure/DelegateDisposable.cs +++ b/backend/src/Squidex.Infrastructure/DelegateDisposable.cs @@ -15,7 +15,7 @@ namespace Squidex.Infrastructure public DelegateDisposable(Action action) { - Guard.NotNull(action); + Guard.NotNull(action, nameof(action)); this.action = action; } diff --git a/backend/src/Squidex.Infrastructure/Diagnostics/GCHealthCheck.cs b/backend/src/Squidex.Infrastructure/Diagnostics/GCHealthCheck.cs index 1dcb2d582..98940e086 100644 --- a/backend/src/Squidex.Infrastructure/Diagnostics/GCHealthCheck.cs +++ b/backend/src/Squidex.Infrastructure/Diagnostics/GCHealthCheck.cs @@ -20,7 +20,7 @@ namespace Squidex.Infrastructure.Diagnostics public GCHealthCheck(IOptions options) { - Guard.NotNull(options); + Guard.NotNull(options, nameof(options)); threshold = 1024 * 1024 * options.Value.Threshold; } diff --git a/backend/src/Squidex.Infrastructure/Diagnostics/OrleansHealthCheck.cs b/backend/src/Squidex.Infrastructure/Diagnostics/OrleansHealthCheck.cs index a2cf9e4f4..e80ad1c83 100644 --- a/backend/src/Squidex.Infrastructure/Diagnostics/OrleansHealthCheck.cs +++ b/backend/src/Squidex.Infrastructure/Diagnostics/OrleansHealthCheck.cs @@ -19,7 +19,7 @@ namespace Squidex.Infrastructure.Diagnostics public OrleansHealthCheck(IGrainFactory grainFactory) { - Guard.NotNull(grainFactory); + Guard.NotNull(grainFactory, nameof(grainFactory)); managementGrain = grainFactory.GetGrain(0); } diff --git a/backend/src/Squidex.Infrastructure/Email/SmtpEmailSender.cs b/backend/src/Squidex.Infrastructure/Email/SmtpEmailSender.cs index 9a0108471..214fd37e6 100644 --- a/backend/src/Squidex.Infrastructure/Email/SmtpEmailSender.cs +++ b/backend/src/Squidex.Infrastructure/Email/SmtpEmailSender.cs @@ -54,7 +54,7 @@ namespace Squidex.Infrastructure.Email public SmtpEmailSender(IOptions options) { - Guard.NotNull(options); + Guard.NotNull(options, nameof(options)); this.options = options.Value; diff --git a/backend/src/Squidex.Infrastructure/EventSourcing/CompoundEventConsumer.cs b/backend/src/Squidex.Infrastructure/EventSourcing/CompoundEventConsumer.cs index d594b2590..974711988 100644 --- a/backend/src/Squidex.Infrastructure/EventSourcing/CompoundEventConsumer.cs +++ b/backend/src/Squidex.Infrastructure/EventSourcing/CompoundEventConsumer.cs @@ -25,8 +25,8 @@ namespace Squidex.Infrastructure.EventSourcing public CompoundEventConsumer(IEventConsumer[] inners) { - Guard.NotNull(inners); - Guard.NotEmpty(inners); + Guard.NotNull(inners, nameof(inners)); + Guard.NotEmpty(inners, nameof(inners)); this.inners = inners; @@ -41,9 +41,9 @@ namespace Squidex.Infrastructure.EventSourcing public CompoundEventConsumer(string name, IEventConsumer first, params IEventConsumer[] inners) { - Guard.NotNull(first); - Guard.NotNull(inners); - Guard.NotNullOrEmpty(name); + Guard.NotNull(first, nameof(first)); + Guard.NotNull(inners, nameof(inners)); + Guard.NotNullOrEmpty(name, nameof(name)); this.inners = new[] { first }.Union(inners).ToArray(); diff --git a/backend/src/Squidex.Infrastructure/EventSourcing/DefaultEventDataFormatter.cs b/backend/src/Squidex.Infrastructure/EventSourcing/DefaultEventDataFormatter.cs index 2e93cac7a..55fe5dfd1 100644 --- a/backend/src/Squidex.Infrastructure/EventSourcing/DefaultEventDataFormatter.cs +++ b/backend/src/Squidex.Infrastructure/EventSourcing/DefaultEventDataFormatter.cs @@ -20,8 +20,8 @@ namespace Squidex.Infrastructure.EventSourcing public DefaultEventDataFormatter(TypeNameRegistry typeNameRegistry, IJsonSerializer serializer) { - Guard.NotNull(typeNameRegistry); - Guard.NotNull(serializer); + Guard.NotNull(typeNameRegistry, nameof(typeNameRegistry)); + Guard.NotNull(serializer, nameof(serializer)); this.typeNameRegistry = typeNameRegistry; diff --git a/backend/src/Squidex.Infrastructure/EventSourcing/Envelope{T}.cs b/backend/src/Squidex.Infrastructure/EventSourcing/Envelope{T}.cs index 864b28664..4310f2c5b 100644 --- a/backend/src/Squidex.Infrastructure/EventSourcing/Envelope{T}.cs +++ b/backend/src/Squidex.Infrastructure/EventSourcing/Envelope{T}.cs @@ -24,7 +24,7 @@ namespace Squidex.Infrastructure.EventSourcing public Envelope(T payload, EnvelopeHeaders? headers = null) { - Guard.NotNull(payload); + Guard.NotNull(payload, nameof(payload)); this.payload = payload; diff --git a/backend/src/Squidex.Infrastructure/EventSourcing/EventConsumersHealthCheck.cs b/backend/src/Squidex.Infrastructure/EventSourcing/EventConsumersHealthCheck.cs index d7d99730a..ee77093c2 100644 --- a/backend/src/Squidex.Infrastructure/EventSourcing/EventConsumersHealthCheck.cs +++ b/backend/src/Squidex.Infrastructure/EventSourcing/EventConsumersHealthCheck.cs @@ -21,7 +21,7 @@ namespace Squidex.Infrastructure.EventSourcing public EventConsumersHealthCheck(IGrainFactory grainFactory) { - Guard.NotNull(grainFactory); + Guard.NotNull(grainFactory, nameof(grainFactory)); this.grainFactory = grainFactory; } diff --git a/backend/src/Squidex.Infrastructure/EventSourcing/EventData.cs b/backend/src/Squidex.Infrastructure/EventSourcing/EventData.cs index 47198a953..016043919 100644 --- a/backend/src/Squidex.Infrastructure/EventSourcing/EventData.cs +++ b/backend/src/Squidex.Infrastructure/EventSourcing/EventData.cs @@ -17,9 +17,9 @@ namespace Squidex.Infrastructure.EventSourcing public EventData(string type, EnvelopeHeaders headers, string payload) { - Guard.NotNull(type); - Guard.NotNull(headers); - Guard.NotNull(payload); + Guard.NotNull(type, nameof(type)); + Guard.NotNull(headers, nameof(headers)); + Guard.NotNull(payload, nameof(payload)); Headers = headers; diff --git a/backend/src/Squidex.Infrastructure/EventSourcing/Grains/EventConsumerGrain.cs b/backend/src/Squidex.Infrastructure/EventSourcing/Grains/EventConsumerGrain.cs index dbad484db..3bb246b27 100644 --- a/backend/src/Squidex.Infrastructure/EventSourcing/Grains/EventConsumerGrain.cs +++ b/backend/src/Squidex.Infrastructure/EventSourcing/Grains/EventConsumerGrain.cs @@ -35,11 +35,11 @@ namespace Squidex.Infrastructure.EventSourcing.Grains IEventDataFormatter eventDataFormatter, ISemanticLog log) { - Guard.NotNull(eventStore); - Guard.NotNull(eventDataFormatter); - Guard.NotNull(eventConsumerFactory); - Guard.NotNull(state); - Guard.NotNull(log); + Guard.NotNull(eventStore, nameof(eventStore)); + Guard.NotNull(eventDataFormatter, nameof(eventDataFormatter)); + Guard.NotNull(eventConsumerFactory, nameof(eventConsumerFactory)); + Guard.NotNull(state, nameof(state)); + Guard.NotNull(log, nameof(log)); this.eventStore = eventStore; this.eventDataFormatter = eventDataFormatter; diff --git a/backend/src/Squidex.Infrastructure/EventSourcing/Grains/EventConsumerManagerGrain.cs b/backend/src/Squidex.Infrastructure/EventSourcing/Grains/EventConsumerManagerGrain.cs index 329dee5da..d361ddb62 100644 --- a/backend/src/Squidex.Infrastructure/EventSourcing/Grains/EventConsumerManagerGrain.cs +++ b/backend/src/Squidex.Infrastructure/EventSourcing/Grains/EventConsumerManagerGrain.cs @@ -32,7 +32,7 @@ namespace Squidex.Infrastructure.EventSourcing.Grains IGrainRuntime? runtime) : base(identity, runtime) { - Guard.NotNull(eventConsumers); + Guard.NotNull(eventConsumers, nameof(eventConsumers)); this.eventConsumers = eventConsumers; } diff --git a/backend/src/Squidex.Infrastructure/EventSourcing/Grains/OrleansEventNotifier.cs b/backend/src/Squidex.Infrastructure/EventSourcing/Grains/OrleansEventNotifier.cs index 898464730..425f1681f 100644 --- a/backend/src/Squidex.Infrastructure/EventSourcing/Grains/OrleansEventNotifier.cs +++ b/backend/src/Squidex.Infrastructure/EventSourcing/Grains/OrleansEventNotifier.cs @@ -17,7 +17,7 @@ namespace Squidex.Infrastructure.EventSourcing.Grains public OrleansEventNotifier(IGrainFactory factory) { - Guard.NotNull(factory); + Guard.NotNull(factory, nameof(factory)); eventConsumerManagerGrain = new Lazy(() => { diff --git a/backend/src/Squidex.Infrastructure/EventSourcing/PollingSubscription.cs b/backend/src/Squidex.Infrastructure/EventSourcing/PollingSubscription.cs index 9323bdd86..13ef44fa0 100644 --- a/backend/src/Squidex.Infrastructure/EventSourcing/PollingSubscription.cs +++ b/backend/src/Squidex.Infrastructure/EventSourcing/PollingSubscription.cs @@ -21,8 +21,8 @@ namespace Squidex.Infrastructure.EventSourcing string? streamFilter, string? position) { - Guard.NotNull(eventStore); - Guard.NotNull(eventSubscriber); + Guard.NotNull(eventStore, nameof(eventStore)); + Guard.NotNull(eventSubscriber, nameof(eventSubscriber)); timer = new CompletionTimer(5000, async ct => { diff --git a/backend/src/Squidex.Infrastructure/EventSourcing/RetrySubscription.cs b/backend/src/Squidex.Infrastructure/EventSourcing/RetrySubscription.cs index 229e62860..8f1c709c9 100644 --- a/backend/src/Squidex.Infrastructure/EventSourcing/RetrySubscription.cs +++ b/backend/src/Squidex.Infrastructure/EventSourcing/RetrySubscription.cs @@ -29,9 +29,9 @@ namespace Squidex.Infrastructure.EventSourcing public RetrySubscription(IEventStore eventStore, IEventSubscriber eventSubscriber, string? streamFilter, string? position) { - Guard.NotNull(eventStore); - Guard.NotNull(eventSubscriber); - Guard.NotNull(streamFilter); + Guard.NotNull(eventStore, nameof(eventStore)); + Guard.NotNull(eventSubscriber, nameof(eventSubscriber)); + Guard.NotNull(streamFilter, nameof(streamFilter)); this.position = position; diff --git a/backend/src/Squidex.Infrastructure/EventSourcing/StoredEvent.cs b/backend/src/Squidex.Infrastructure/EventSourcing/StoredEvent.cs index e6418d7f3..97ee0f55c 100644 --- a/backend/src/Squidex.Infrastructure/EventSourcing/StoredEvent.cs +++ b/backend/src/Squidex.Infrastructure/EventSourcing/StoredEvent.cs @@ -19,9 +19,9 @@ namespace Squidex.Infrastructure.EventSourcing public StoredEvent(string streamName, string eventPosition, long eventStreamNumber, EventData data) { - Guard.NotNullOrEmpty(streamName); - Guard.NotNullOrEmpty(eventPosition); - Guard.NotNull(data); + Guard.NotNullOrEmpty(streamName, nameof(streamName)); + Guard.NotNullOrEmpty(eventPosition, nameof(eventPosition)); + Guard.NotNull(data, nameof(data)); Data = data; diff --git a/backend/src/Squidex.Infrastructure/Guard.cs b/backend/src/Squidex.Infrastructure/Guard.cs index 62e9971e3..7ed6bdbd5 100644 --- a/backend/src/Squidex.Infrastructure/Guard.cs +++ b/backend/src/Squidex.Infrastructure/Guard.cs @@ -19,7 +19,7 @@ namespace Squidex.Infrastructure { [DebuggerStepThrough] [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void ValidNumber(float target, [CallerArgumentExpression("target")] string? parameterName = null) + public static void ValidNumber(float target, string parameterName) { if (float.IsNaN(target) || float.IsPositiveInfinity(target) || float.IsNegativeInfinity(target)) { @@ -29,7 +29,7 @@ namespace Squidex.Infrastructure [DebuggerStepThrough] [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void ValidNumber(double target, [CallerArgumentExpression("target")] string? parameterName = null) + public static void ValidNumber(double target, string parameterName) { if (double.IsNaN(target) || double.IsPositiveInfinity(target) || double.IsNegativeInfinity(target)) { @@ -39,7 +39,7 @@ namespace Squidex.Infrastructure [DebuggerStepThrough] [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void ValidSlug(string? target, [CallerArgumentExpression("target")] string? parameterName = null) + public static void ValidSlug(string? target, string parameterName) { NotNullOrEmpty(target, parameterName); @@ -51,7 +51,7 @@ namespace Squidex.Infrastructure [DebuggerStepThrough] [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void ValidPropertyName(string? target, [CallerArgumentExpression("target")] string? parameterName = null) + public static void ValidPropertyName(string? target, string parameterName) { NotNullOrEmpty(target, parameterName); @@ -63,7 +63,7 @@ namespace Squidex.Infrastructure [DebuggerStepThrough] [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void HasType(object? target, [CallerArgumentExpression("target")] string? parameterName = null) + public static void HasType(object? target, string parameterName) { if (target != null && target.GetType() != typeof(T)) { @@ -73,7 +73,7 @@ namespace Squidex.Infrastructure [DebuggerStepThrough] [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void HasType(object? target, Type? expectedType, [CallerArgumentExpression("target")] string? parameterName = null) + public static void HasType(object? target, Type? expectedType, string parameterName) { if (target != null && expectedType != null && target.GetType() != expectedType) { @@ -83,7 +83,7 @@ namespace Squidex.Infrastructure [DebuggerStepThrough] [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void Between(TValue target, TValue lower, TValue upper, [CallerArgumentExpression("target")] string? parameterName = null) where TValue : IComparable + public static void Between(TValue target, TValue lower, TValue upper, string parameterName) where TValue : IComparable { if (!target.IsBetween(lower, upper)) { @@ -93,7 +93,7 @@ namespace Squidex.Infrastructure [DebuggerStepThrough] [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void Enum(TEnum target, [CallerArgumentExpression("target")] string? parameterName = null) where TEnum : struct + public static void Enum(TEnum target, string parameterName) where TEnum : struct { if (!target.IsEnumValue()) { @@ -103,7 +103,7 @@ namespace Squidex.Infrastructure [DebuggerStepThrough] [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void GreaterThan(TValue target, TValue lower, [CallerArgumentExpression("target")] string? parameterName = null) where TValue : IComparable + public static void GreaterThan(TValue target, TValue lower, string parameterName) where TValue : IComparable { if (target.CompareTo(lower) <= 0) { @@ -113,7 +113,7 @@ namespace Squidex.Infrastructure [DebuggerStepThrough] [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void GreaterEquals(TValue target, TValue lower, [CallerArgumentExpression("target")] string? parameterName = null) where TValue : IComparable + public static void GreaterEquals(TValue target, TValue lower, string parameterName) where TValue : IComparable { if (target.CompareTo(lower) < 0) { @@ -123,7 +123,7 @@ namespace Squidex.Infrastructure [DebuggerStepThrough] [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void LessThan(TValue target, TValue upper, [CallerArgumentExpression("target")] string? parameterName = null) where TValue : IComparable + public static void LessThan(TValue target, TValue upper, string parameterName) where TValue : IComparable { if (target.CompareTo(upper) >= 0) { @@ -133,7 +133,7 @@ namespace Squidex.Infrastructure [DebuggerStepThrough] [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void LessEquals(TValue target, TValue upper, [CallerArgumentExpression("target")] string? parameterName = null) where TValue : IComparable + public static void LessEquals(TValue target, TValue upper, string parameterName) where TValue : IComparable { if (target.CompareTo(upper) > 0) { @@ -143,7 +143,7 @@ namespace Squidex.Infrastructure [DebuggerStepThrough] [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void NotEmpty(IReadOnlyCollection? target, [CallerArgumentExpression("target")] string? parameterName = null) + public static void NotEmpty(IReadOnlyCollection? target, string parameterName) { NotNull(target, parameterName); @@ -155,7 +155,7 @@ namespace Squidex.Infrastructure [DebuggerStepThrough] [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void NotEmpty(Guid target, [CallerArgumentExpression("target")] string? parameterName = null) + public static void NotEmpty(Guid target, string parameterName) { if (target == Guid.Empty) { @@ -164,8 +164,7 @@ namespace Squidex.Infrastructure } [DebuggerStepThrough] - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void NotNull(object? target, [CallerArgumentExpression("target")] string? parameterName = null) + public static void NotNull(object? target, string parameterName) { if (target == null) { @@ -175,7 +174,7 @@ namespace Squidex.Infrastructure [DebuggerStepThrough] [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void NotDefault(T target, [CallerArgumentExpression("target")] string? parameterName = null) + public static void NotDefault(T target, string parameterName) { if (Equals(target, default(T)!)) { @@ -185,7 +184,7 @@ namespace Squidex.Infrastructure [DebuggerStepThrough] [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void NotNullOrEmpty(string? target, [CallerArgumentExpression("target")] string? parameterName = null) + public static void NotNullOrEmpty(string? target, string parameterName) { NotNull(target, parameterName); @@ -197,7 +196,7 @@ namespace Squidex.Infrastructure [DebuggerStepThrough] [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void ValidFileName(string? target, [CallerArgumentExpression("target")] string? parameterName = null) + public static void ValidFileName(string? target, string parameterName) { NotNullOrEmpty(target, parameterName); diff --git a/backend/src/Squidex.Infrastructure/Json/Newtonsoft/NewtonsoftJsonSerializer.cs b/backend/src/Squidex.Infrastructure/Json/Newtonsoft/NewtonsoftJsonSerializer.cs index 5f59b584e..9deee78c9 100644 --- a/backend/src/Squidex.Infrastructure/Json/Newtonsoft/NewtonsoftJsonSerializer.cs +++ b/backend/src/Squidex.Infrastructure/Json/Newtonsoft/NewtonsoftJsonSerializer.cs @@ -44,7 +44,7 @@ namespace Squidex.Infrastructure.Json.Newtonsoft public NewtonsoftJsonSerializer(JsonSerializerSettings settings) { - Guard.NotNull(settings); + Guard.NotNull(settings, nameof(settings)); this.settings = settings; diff --git a/backend/src/Squidex.Infrastructure/Json/Newtonsoft/TypeNameSerializationBinder.cs b/backend/src/Squidex.Infrastructure/Json/Newtonsoft/TypeNameSerializationBinder.cs index 0b4fccea3..ad9f752e9 100644 --- a/backend/src/Squidex.Infrastructure/Json/Newtonsoft/TypeNameSerializationBinder.cs +++ b/backend/src/Squidex.Infrastructure/Json/Newtonsoft/TypeNameSerializationBinder.cs @@ -17,7 +17,7 @@ namespace Squidex.Infrastructure.Json.Newtonsoft public TypeNameSerializationBinder(TypeNameRegistry typeNameRegistry) { - Guard.NotNull(typeNameRegistry); + Guard.NotNull(typeNameRegistry, nameof(typeNameRegistry)); this.typeNameRegistry = typeNameRegistry; } diff --git a/backend/src/Squidex.Infrastructure/Json/Objects/JsonArray.cs b/backend/src/Squidex.Infrastructure/Json/Objects/JsonArray.cs index 33cc19b1c..c8f96e814 100644 --- a/backend/src/Squidex.Infrastructure/Json/Objects/JsonArray.cs +++ b/backend/src/Squidex.Infrastructure/Json/Objects/JsonArray.cs @@ -112,7 +112,7 @@ namespace Squidex.Infrastructure.Json.Objects public bool TryGet(string pathSegment, [MaybeNullWhen(false)] out IJsonValue result) { - Guard.NotNull(pathSegment); + Guard.NotNull(pathSegment, nameof(pathSegment)); if (pathSegment != null && int.TryParse(pathSegment, NumberStyles.Integer, CultureInfo.InvariantCulture, out var index) && index >= 0 && index < Count) { diff --git a/backend/src/Squidex.Infrastructure/Json/Objects/JsonObject.cs b/backend/src/Squidex.Infrastructure/Json/Objects/JsonObject.cs index bc0d045c8..04198efda 100644 --- a/backend/src/Squidex.Infrastructure/Json/Objects/JsonObject.cs +++ b/backend/src/Squidex.Infrastructure/Json/Objects/JsonObject.cs @@ -25,7 +25,7 @@ namespace Squidex.Infrastructure.Json.Objects } set { - Guard.NotNull(key); + Guard.NotNull(key, nameof(key)); inner[key] = value ?? JsonValue.Null; } @@ -145,7 +145,7 @@ namespace Squidex.Infrastructure.Json.Objects public bool TryGet(string pathSegment, [MaybeNullWhen(false)] out IJsonValue result) { - Guard.NotNull(pathSegment); + Guard.NotNull(pathSegment, nameof(pathSegment)); return TryGetValue(pathSegment, out result!); } diff --git a/backend/src/Squidex.Infrastructure/Json/Objects/JsonValue.cs b/backend/src/Squidex.Infrastructure/Json/Objects/JsonValue.cs index bcb07f88e..46330f893 100644 --- a/backend/src/Squidex.Infrastructure/Json/Objects/JsonValue.cs +++ b/backend/src/Squidex.Infrastructure/Json/Objects/JsonValue.cs @@ -109,7 +109,7 @@ namespace Squidex.Infrastructure.Json.Objects public static IJsonValue Create(double value) { - Guard.ValidNumber(value); + Guard.ValidNumber(value, nameof(value)); if (value == 0) { diff --git a/backend/src/Squidex.Infrastructure/Language.cs b/backend/src/Squidex.Infrastructure/Language.cs index 1b5dd27a2..a799a5351 100644 --- a/backend/src/Squidex.Infrastructure/Language.cs +++ b/backend/src/Squidex.Infrastructure/Language.cs @@ -25,7 +25,7 @@ namespace Squidex.Infrastructure public static Language GetLanguage(string iso2Code) { - Guard.NotNullOrEmpty(iso2Code); + Guard.NotNullOrEmpty(iso2Code, nameof(iso2Code)); try { @@ -56,14 +56,14 @@ namespace Squidex.Infrastructure public static bool IsValidLanguage(string iso2Code) { - Guard.NotNull(iso2Code); + Guard.NotNull(iso2Code, nameof(iso2Code)); return AllLanguagesField.ContainsKey(iso2Code); } public static bool TryGetLanguage(string iso2Code, [MaybeNullWhen(false)] out Language language) { - Guard.NotNull(iso2Code); + Guard.NotNull(iso2Code, nameof(iso2Code)); return AllLanguagesField.TryGetValue(iso2Code, out language!); } diff --git a/backend/src/Squidex.Infrastructure/LanguagesInitializer.cs b/backend/src/Squidex.Infrastructure/LanguagesInitializer.cs index a018ba794..e60793cfa 100644 --- a/backend/src/Squidex.Infrastructure/LanguagesInitializer.cs +++ b/backend/src/Squidex.Infrastructure/LanguagesInitializer.cs @@ -17,7 +17,7 @@ namespace Squidex.Infrastructure public LanguagesInitializer(IOptions options) { - Guard.NotNull(options); + Guard.NotNull(options, nameof(options)); this.options = options.Value; } diff --git a/backend/src/Squidex.Infrastructure/Log/Adapter/SemanticLogLoggerProvider.cs b/backend/src/Squidex.Infrastructure/Log/Adapter/SemanticLogLoggerProvider.cs index 931f3312f..1f3862b11 100644 --- a/backend/src/Squidex.Infrastructure/Log/Adapter/SemanticLogLoggerProvider.cs +++ b/backend/src/Squidex.Infrastructure/Log/Adapter/SemanticLogLoggerProvider.cs @@ -18,7 +18,7 @@ namespace Squidex.Infrastructure.Log.Adapter public SemanticLogLoggerProvider(IServiceProvider services) { - Guard.NotNull(services); + Guard.NotNull(services, nameof(services)); this.services = services; } diff --git a/backend/src/Squidex.Infrastructure/Log/ApplicationInfoLogAppender.cs b/backend/src/Squidex.Infrastructure/Log/ApplicationInfoLogAppender.cs index 487000916..bf434feac 100644 --- a/backend/src/Squidex.Infrastructure/Log/ApplicationInfoLogAppender.cs +++ b/backend/src/Squidex.Infrastructure/Log/ApplicationInfoLogAppender.cs @@ -23,7 +23,7 @@ namespace Squidex.Infrastructure.Log public ApplicationInfoLogAppender(Assembly assembly, Guid applicationSession) { - Guard.NotNull(assembly); + Guard.NotNull(assembly, nameof(assembly)); applicationName = assembly.GetName().Name!; applicationVersion = assembly.GetName().Version!.ToString()!; diff --git a/backend/src/Squidex.Infrastructure/Log/ConstantsLogWriter.cs b/backend/src/Squidex.Infrastructure/Log/ConstantsLogWriter.cs index 9af8ebe8c..d3c4a5e2a 100644 --- a/backend/src/Squidex.Infrastructure/Log/ConstantsLogWriter.cs +++ b/backend/src/Squidex.Infrastructure/Log/ConstantsLogWriter.cs @@ -15,7 +15,7 @@ namespace Squidex.Infrastructure.Log public ConstantsLogWriter(Action objectWriter) { - Guard.NotNull(objectWriter); + Guard.NotNull(objectWriter, nameof(objectWriter)); this.objectWriter = objectWriter; } diff --git a/backend/src/Squidex.Infrastructure/Log/FileChannel.cs b/backend/src/Squidex.Infrastructure/Log/FileChannel.cs index 897aa0693..26a8392e6 100644 --- a/backend/src/Squidex.Infrastructure/Log/FileChannel.cs +++ b/backend/src/Squidex.Infrastructure/Log/FileChannel.cs @@ -17,7 +17,7 @@ namespace Squidex.Infrastructure.Log public FileChannel(string path) { - Guard.NotNullOrEmpty(path); + Guard.NotNullOrEmpty(path, nameof(path)); processor = new FileLogProcessor(path); } diff --git a/backend/src/Squidex.Infrastructure/Log/Profiler.cs b/backend/src/Squidex.Infrastructure/Log/Profiler.cs index 87b36515b..ed4d7f3c3 100644 --- a/backend/src/Squidex.Infrastructure/Log/Profiler.cs +++ b/backend/src/Squidex.Infrastructure/Log/Profiler.cs @@ -55,7 +55,7 @@ namespace Squidex.Infrastructure.Log public static IDisposable Trace(string key) { - Guard.NotNull(key); + Guard.NotNull(key, nameof(key)); var session = LocalSession.Value; diff --git a/backend/src/Squidex.Infrastructure/Log/ProfilerSession.cs b/backend/src/Squidex.Infrastructure/Log/ProfilerSession.cs index 3278e3e2d..f134105a3 100644 --- a/backend/src/Squidex.Infrastructure/Log/ProfilerSession.cs +++ b/backend/src/Squidex.Infrastructure/Log/ProfilerSession.cs @@ -21,7 +21,7 @@ namespace Squidex.Infrastructure.Log public void Measured(string name, long elapsed) { - Guard.NotNullOrEmpty(name); + Guard.NotNullOrEmpty(name, nameof(name)); traces.AddOrUpdate(name, x => { @@ -38,7 +38,7 @@ namespace Squidex.Infrastructure.Log public void Write(IObjectWriter writer) { - Guard.NotNull(writer); + Guard.NotNull(writer, nameof(writer)); if (traces.Count > 0) { diff --git a/backend/src/Squidex.Infrastructure/Log/ProfilerSpan.cs b/backend/src/Squidex.Infrastructure/Log/ProfilerSpan.cs index 28138a7f2..771114415 100644 --- a/backend/src/Squidex.Infrastructure/Log/ProfilerSpan.cs +++ b/backend/src/Squidex.Infrastructure/Log/ProfilerSpan.cs @@ -34,7 +34,7 @@ namespace Squidex.Infrastructure.Log public void Listen(IDisposable hook) { - Guard.NotNull(hook); + Guard.NotNull(hook, nameof(hook)); if (hooks == null) { diff --git a/backend/src/Squidex.Infrastructure/Log/SemanticLog.cs b/backend/src/Squidex.Infrastructure/Log/SemanticLog.cs index b592a1452..2ef09e464 100644 --- a/backend/src/Squidex.Infrastructure/Log/SemanticLog.cs +++ b/backend/src/Squidex.Infrastructure/Log/SemanticLog.cs @@ -25,10 +25,10 @@ namespace Squidex.Infrastructure.Log IEnumerable appenders, IObjectWriterFactory writerFactory) { - Guard.NotNull(options); - Guard.NotNull(channels); - Guard.NotNull(appenders); - Guard.NotNull(writerFactory); + Guard.NotNull(options, nameof(options)); + Guard.NotNull(channels, nameof(channels)); + Guard.NotNull(appenders, nameof(appenders)); + Guard.NotNull(writerFactory, nameof(writerFactory)); this.options = options; this.channels = channels.ToArray(); @@ -38,7 +38,7 @@ namespace Squidex.Infrastructure.Log public void Log(SemanticLogLevel logLevel, T context, Exception? exception, LogFormatter action) { - Guard.NotNull(action); + Guard.NotNull(action, nameof(action)); if (logLevel < options.Value.Level) { @@ -52,7 +52,7 @@ namespace Squidex.Infrastructure.Log public void Log(SemanticLogLevel logLevel, Exception? exception, LogFormatter action) { - Guard.NotNull(action); + Guard.NotNull(action, nameof(action)); if (logLevel < options.Value.Level) { diff --git a/backend/src/Squidex.Infrastructure/Log/Store/BackgroundRequestLogStore.cs b/backend/src/Squidex.Infrastructure/Log/Store/BackgroundRequestLogStore.cs index 86766b13d..8343209e8 100644 --- a/backend/src/Squidex.Infrastructure/Log/Store/BackgroundRequestLogStore.cs +++ b/backend/src/Squidex.Infrastructure/Log/Store/BackgroundRequestLogStore.cs @@ -25,8 +25,8 @@ namespace Squidex.Infrastructure.Log.Store public BackgroundRequestLogStore(IRequestLogRepository logRepository, ISemanticLog log) { - Guard.NotNull(logRepository); - Guard.NotNull(log); + Guard.NotNull(logRepository, nameof(logRepository)); + Guard.NotNull(log, nameof(log)); this.logRepository = logRepository; this.log = log; @@ -80,7 +80,7 @@ namespace Squidex.Infrastructure.Log.Store public Task LogAsync(Request request) { - Guard.NotNull(request); + Guard.NotNull(request, nameof(request)); jobs.Enqueue(request); diff --git a/backend/src/Squidex.Infrastructure/Migrations/Migrator.cs b/backend/src/Squidex.Infrastructure/Migrations/Migrator.cs index 96ede37f2..fd03b0cc3 100644 --- a/backend/src/Squidex.Infrastructure/Migrations/Migrator.cs +++ b/backend/src/Squidex.Infrastructure/Migrations/Migrator.cs @@ -23,9 +23,9 @@ namespace Squidex.Infrastructure.Migrations public Migrator(IMigrationStatus migrationStatus, IMigrationPath migrationPath, ISemanticLog log) { - Guard.NotNull(migrationStatus); - Guard.NotNull(migrationPath); - Guard.NotNull(log); + Guard.NotNull(migrationStatus, nameof(migrationStatus)); + Guard.NotNull(migrationPath, nameof(migrationPath)); + Guard.NotNull(log, nameof(log)); this.migrationStatus = migrationStatus; this.migrationPath = migrationPath; diff --git a/backend/src/Squidex.Infrastructure/NamedId{T}.cs b/backend/src/Squidex.Infrastructure/NamedId{T}.cs index 5ab243df4..b93671e34 100644 --- a/backend/src/Squidex.Infrastructure/NamedId{T}.cs +++ b/backend/src/Squidex.Infrastructure/NamedId{T}.cs @@ -25,8 +25,8 @@ namespace Squidex.Infrastructure public NamedId(T id, string name) { - Guard.NotNull(id); - Guard.NotNull(name); + Guard.NotNull(id, nameof(id)); + Guard.NotNull(name, nameof(name)); Id = id; diff --git a/backend/src/Squidex.Infrastructure/Orleans/ActivationLimit.cs b/backend/src/Squidex.Infrastructure/Orleans/ActivationLimit.cs index 14d858523..fd261a7c8 100644 --- a/backend/src/Squidex.Infrastructure/Orleans/ActivationLimit.cs +++ b/backend/src/Squidex.Infrastructure/Orleans/ActivationLimit.cs @@ -21,8 +21,8 @@ namespace Squidex.Infrastructure.Orleans public ActivationLimit(IGrainActivationContext context, IActivationLimiter limiter) { - Guard.NotNull(context); - Guard.NotNull(limiter); + Guard.NotNull(context, nameof(context)); + Guard.NotNull(limiter, nameof(limiter)); this.context = context; this.limiter = limiter; diff --git a/backend/src/Squidex.Infrastructure/Orleans/GrainBootstrap.cs b/backend/src/Squidex.Infrastructure/Orleans/GrainBootstrap.cs index 16cc558db..cebe9623f 100644 --- a/backend/src/Squidex.Infrastructure/Orleans/GrainBootstrap.cs +++ b/backend/src/Squidex.Infrastructure/Orleans/GrainBootstrap.cs @@ -19,7 +19,7 @@ namespace Squidex.Infrastructure.Orleans public GrainBootstrap(IGrainFactory grainFactory) { - Guard.NotNull(grainFactory); + Guard.NotNull(grainFactory, nameof(grainFactory)); this.grainFactory = grainFactory; } diff --git a/backend/src/Squidex.Infrastructure/Orleans/GrainState.cs b/backend/src/Squidex.Infrastructure/Orleans/GrainState.cs index 6c07ee7f0..d688acabd 100644 --- a/backend/src/Squidex.Infrastructure/Orleans/GrainState.cs +++ b/backend/src/Squidex.Infrastructure/Orleans/GrainState.cs @@ -30,7 +30,7 @@ namespace Squidex.Infrastructure.Orleans public GrainState(IGrainActivationContext context) { - Guard.NotNull(context); + Guard.NotNull(context, nameof(context)); this.context = context; diff --git a/backend/src/Squidex.Infrastructure/Orleans/Indexes/IdsIndexGrain.cs b/backend/src/Squidex.Infrastructure/Orleans/Indexes/IdsIndexGrain.cs index d30d9714d..fdae2ceb2 100644 --- a/backend/src/Squidex.Infrastructure/Orleans/Indexes/IdsIndexGrain.cs +++ b/backend/src/Squidex.Infrastructure/Orleans/Indexes/IdsIndexGrain.cs @@ -18,7 +18,7 @@ namespace Squidex.Infrastructure.Orleans.Indexes public IdsIndexGrain(IGrainState state) { - Guard.NotNull(state); + Guard.NotNull(state, nameof(state)); this.state = state; } diff --git a/backend/src/Squidex.Infrastructure/Orleans/Indexes/UniqueNameIndexGrain.cs b/backend/src/Squidex.Infrastructure/Orleans/Indexes/UniqueNameIndexGrain.cs index 0b35ebcaf..2a05e3d04 100644 --- a/backend/src/Squidex.Infrastructure/Orleans/Indexes/UniqueNameIndexGrain.cs +++ b/backend/src/Squidex.Infrastructure/Orleans/Indexes/UniqueNameIndexGrain.cs @@ -19,7 +19,7 @@ namespace Squidex.Infrastructure.Orleans.Indexes public UniqueNameIndexGrain(IGrainState state) { - Guard.NotNull(state); + Guard.NotNull(state, nameof(state)); this.state = state; } diff --git a/backend/src/Squidex.Infrastructure/Orleans/LocalCacheFilter.cs b/backend/src/Squidex.Infrastructure/Orleans/LocalCacheFilter.cs index 68700741c..6e7dec26a 100644 --- a/backend/src/Squidex.Infrastructure/Orleans/LocalCacheFilter.cs +++ b/backend/src/Squidex.Infrastructure/Orleans/LocalCacheFilter.cs @@ -18,7 +18,7 @@ namespace Squidex.Infrastructure.Orleans public LocalCacheFilter(ILocalCache localCache) { - Guard.NotNull(localCache); + Guard.NotNull(localCache, nameof(localCache)); this.localCache = localCache; } diff --git a/backend/src/Squidex.Infrastructure/Orleans/LoggingFilter.cs b/backend/src/Squidex.Infrastructure/Orleans/LoggingFilter.cs index 61ff39d00..b7edc178c 100644 --- a/backend/src/Squidex.Infrastructure/Orleans/LoggingFilter.cs +++ b/backend/src/Squidex.Infrastructure/Orleans/LoggingFilter.cs @@ -18,7 +18,7 @@ namespace Squidex.Infrastructure.Orleans public LoggingFilter(ISemanticLog log) { - Guard.NotNull(log); + Guard.NotNull(log, nameof(log)); this.log = log; } diff --git a/backend/src/Squidex.Infrastructure/Orleans/StateFilter.cs b/backend/src/Squidex.Infrastructure/Orleans/StateFilter.cs index 9b1faa7ef..78332e218 100644 --- a/backend/src/Squidex.Infrastructure/Orleans/StateFilter.cs +++ b/backend/src/Squidex.Infrastructure/Orleans/StateFilter.cs @@ -19,7 +19,7 @@ namespace Squidex.Infrastructure.Orleans public StateFilter(IGrainRuntime runtime) { - Guard.NotNull(runtime); + Guard.NotNull(runtime, nameof(runtime)); this.runtime = runtime; } diff --git a/backend/src/Squidex.Infrastructure/Plugins/PluginManager.cs b/backend/src/Squidex.Infrastructure/Plugins/PluginManager.cs index 2c3abc9ba..cc83ab0f8 100644 --- a/backend/src/Squidex.Infrastructure/Plugins/PluginManager.cs +++ b/backend/src/Squidex.Infrastructure/Plugins/PluginManager.cs @@ -36,8 +36,8 @@ namespace Squidex.Infrastructure.Plugins public Assembly? Load(string path, AssemblyName[] sharedAssemblies) { - Guard.NotNullOrEmpty(path); - Guard.NotNull(sharedAssemblies); + Guard.NotNullOrEmpty(path, nameof(path)); + Guard.NotNull(sharedAssemblies, nameof(sharedAssemblies)); Assembly? assembly = null; @@ -97,8 +97,8 @@ namespace Squidex.Infrastructure.Plugins public void ConfigureServices(IServiceCollection services, IConfiguration config) { - Guard.NotNull(services); - Guard.NotNull(config); + Guard.NotNull(services, nameof(services)); + Guard.NotNull(config, nameof(config)); foreach (var plugin in loadedPlugins) { @@ -108,7 +108,7 @@ namespace Squidex.Infrastructure.Plugins public void Log(ISemanticLog log) { - Guard.NotNull(log); + Guard.NotNull(log, nameof(log)); if (loadedPlugins.Count > 0 || exceptions.Count > 0) { diff --git a/backend/src/Squidex.Infrastructure/Queries/CompareFilter.cs b/backend/src/Squidex.Infrastructure/Queries/CompareFilter.cs index 3f0ba063d..5b522e6c9 100644 --- a/backend/src/Squidex.Infrastructure/Queries/CompareFilter.cs +++ b/backend/src/Squidex.Infrastructure/Queries/CompareFilter.cs @@ -17,9 +17,9 @@ namespace Squidex.Infrastructure.Queries public CompareFilter(PropertyPath path, CompareOperator @operator, TValue value) { - Guard.NotNull(path); - Guard.NotNull(value); - Guard.Enum(@operator); + Guard.NotNull(path, nameof(path)); + Guard.NotNull(value, nameof(value)); + Guard.Enum(@operator, nameof(@operator)); Path = path; diff --git a/backend/src/Squidex.Infrastructure/Queries/LogicalFilter.cs b/backend/src/Squidex.Infrastructure/Queries/LogicalFilter.cs index 9b207e76e..1fc2a1416 100644 --- a/backend/src/Squidex.Infrastructure/Queries/LogicalFilter.cs +++ b/backend/src/Squidex.Infrastructure/Queries/LogicalFilter.cs @@ -17,8 +17,8 @@ namespace Squidex.Infrastructure.Queries public LogicalFilter(LogicalFilterType type, IReadOnlyList> filters) { - Guard.NotNull(filters); - Guard.Enum(type); + Guard.NotNull(filters, nameof(filters)); + Guard.Enum(type, nameof(type)); Filters = filters; diff --git a/backend/src/Squidex.Infrastructure/Queries/NegateFilter.cs b/backend/src/Squidex.Infrastructure/Queries/NegateFilter.cs index e4deb18d2..09583a0f8 100644 --- a/backend/src/Squidex.Infrastructure/Queries/NegateFilter.cs +++ b/backend/src/Squidex.Infrastructure/Queries/NegateFilter.cs @@ -13,7 +13,7 @@ namespace Squidex.Infrastructure.Queries public NegateFilter(FilterNode filter) { - Guard.NotNull(filter); + Guard.NotNull(filter, nameof(filter)); Filter = filter; } diff --git a/backend/src/Squidex.Infrastructure/Queries/SortNode.cs b/backend/src/Squidex.Infrastructure/Queries/SortNode.cs index 174bb7c22..fa4e47919 100644 --- a/backend/src/Squidex.Infrastructure/Queries/SortNode.cs +++ b/backend/src/Squidex.Infrastructure/Queries/SortNode.cs @@ -15,8 +15,8 @@ namespace Squidex.Infrastructure.Queries public SortNode(PropertyPath path, SortOrder order) { - Guard.NotNull(path); - Guard.Enum(order); + Guard.NotNull(path, nameof(path)); + Guard.Enum(order, nameof(order)); Path = path; diff --git a/backend/src/Squidex.Infrastructure/RefToken.cs b/backend/src/Squidex.Infrastructure/RefToken.cs index 01c8e3e44..e8fd9ca91 100644 --- a/backend/src/Squidex.Infrastructure/RefToken.cs +++ b/backend/src/Squidex.Infrastructure/RefToken.cs @@ -31,8 +31,8 @@ namespace Squidex.Infrastructure public RefToken(string type, string identifier) { - Guard.NotNullOrEmpty(type); - Guard.NotNullOrEmpty(identifier); + Guard.NotNullOrEmpty(type, nameof(type)); + Guard.NotNullOrEmpty(identifier, nameof(identifier)); Type = type.ToLowerInvariant(); diff --git a/backend/src/Squidex.Infrastructure/Reflection/Internal/PropertyAccessor.cs b/backend/src/Squidex.Infrastructure/Reflection/Internal/PropertyAccessor.cs index 01de599bb..15d9bca20 100644 --- a/backend/src/Squidex.Infrastructure/Reflection/Internal/PropertyAccessor.cs +++ b/backend/src/Squidex.Infrastructure/Reflection/Internal/PropertyAccessor.cs @@ -60,8 +60,8 @@ namespace Squidex.Infrastructure.Reflection.Internal public PropertyAccessor(Type targetType, PropertyInfo propertyInfo) { - Guard.NotNull(targetType); - Guard.NotNull(propertyInfo); + Guard.NotNull(targetType, nameof(targetType)); + Guard.NotNull(propertyInfo, nameof(propertyInfo)); var type = typeof(PropertyWrapper<,>).MakeGenericType(propertyInfo.DeclaringType!, propertyInfo.PropertyType); @@ -70,14 +70,14 @@ namespace Squidex.Infrastructure.Reflection.Internal public object? Get(object target) { - Guard.NotNull(target); + Guard.NotNull(target, nameof(target)); return internalAccessor.Get(target); } public void Set(object target, object? value) { - Guard.NotNull(target); + Guard.NotNull(target, nameof(target)); internalAccessor.Set(target, value); } diff --git a/backend/src/Squidex.Infrastructure/Reflection/SimpleMapper.cs b/backend/src/Squidex.Infrastructure/Reflection/SimpleMapper.cs index ca51d78e3..fc2c0b0e0 100644 --- a/backend/src/Squidex.Infrastructure/Reflection/SimpleMapper.cs +++ b/backend/src/Squidex.Infrastructure/Reflection/SimpleMapper.cs @@ -179,9 +179,9 @@ namespace Squidex.Infrastructure.Reflection where TSource : class where TTarget : class { - Guard.NotNull(source); - Guard.NotNull(culture); - Guard.NotNull(target); + Guard.NotNull(source, nameof(source)); + Guard.NotNull(culture, nameof(culture)); + Guard.NotNull(target, nameof(target)); return ClassMapper.MapClass(source, target, culture); } diff --git a/backend/src/Squidex.Infrastructure/Reflection/TypeNameRegistry.cs b/backend/src/Squidex.Infrastructure/Reflection/TypeNameRegistry.cs index 65d4570b9..a2bc15b68 100644 --- a/backend/src/Squidex.Infrastructure/Reflection/TypeNameRegistry.cs +++ b/backend/src/Squidex.Infrastructure/Reflection/TypeNameRegistry.cs @@ -29,8 +29,8 @@ namespace Squidex.Infrastructure.Reflection public TypeNameRegistry MapObsolete(Type type, string name) { - Guard.NotNull(type); - Guard.NotNull(name); + Guard.NotNull(type, nameof(type)); + Guard.NotNull(name, nameof(name)); lock (namesByType) { @@ -49,7 +49,7 @@ namespace Squidex.Infrastructure.Reflection public TypeNameRegistry Map(ITypeProvider provider) { - Guard.NotNull(provider); + Guard.NotNull(provider, nameof(provider)); provider.Map(this); @@ -58,7 +58,7 @@ namespace Squidex.Infrastructure.Reflection public TypeNameRegistry Map(Type type) { - Guard.NotNull(type); + Guard.NotNull(type, nameof(type)); var typeNameAttribute = type.GetCustomAttribute(); @@ -72,8 +72,8 @@ namespace Squidex.Infrastructure.Reflection public TypeNameRegistry Map(Type type, string name) { - Guard.NotNull(type); - Guard.NotNull(name); + Guard.NotNull(type, nameof(type)); + Guard.NotNull(name, nameof(name)); lock (namesByType) { diff --git a/backend/src/Squidex.Infrastructure/Security/Permission.cs b/backend/src/Squidex.Infrastructure/Security/Permission.cs index 27eb33d04..7576c457b 100644 --- a/backend/src/Squidex.Infrastructure/Security/Permission.cs +++ b/backend/src/Squidex.Infrastructure/Security/Permission.cs @@ -31,7 +31,7 @@ namespace Squidex.Infrastructure.Security public Permission(string id) { - Guard.NotNullOrEmpty(id); + Guard.NotNullOrEmpty(id, nameof(id)); this.id = id; } diff --git a/backend/src/Squidex.Infrastructure/Security/PermissionSet.cs b/backend/src/Squidex.Infrastructure/Security/PermissionSet.cs index ab015d611..1452a961b 100644 --- a/backend/src/Squidex.Infrastructure/Security/PermissionSet.cs +++ b/backend/src/Squidex.Infrastructure/Security/PermissionSet.cs @@ -41,7 +41,7 @@ namespace Squidex.Infrastructure.Security public PermissionSet(IEnumerable permissions) { - Guard.NotNull(permissions); + Guard.NotNull(permissions, nameof(permissions)); this.permissions = permissions.ToList(); @@ -50,14 +50,14 @@ namespace Squidex.Infrastructure.Security public PermissionSet Add(string permission) { - Guard.NotNullOrEmpty(permission); + Guard.NotNullOrEmpty(permission, nameof(permission)); return Add(new Permission(permission)); } public PermissionSet Add(Permission permission) { - Guard.NotNull(permission); + Guard.NotNull(permission, nameof(permission)); return new PermissionSet(permissions.Union(Enumerable.Repeat(permission, 1)).Distinct()); } diff --git a/backend/src/Squidex.Infrastructure/States/DefaultStreamNameResolver.cs b/backend/src/Squidex.Infrastructure/States/DefaultStreamNameResolver.cs index 203dc924e..bb671221a 100644 --- a/backend/src/Squidex.Infrastructure/States/DefaultStreamNameResolver.cs +++ b/backend/src/Squidex.Infrastructure/States/DefaultStreamNameResolver.cs @@ -16,16 +16,16 @@ namespace Squidex.Infrastructure.States public string GetStreamName(Type aggregateType, string id) { - Guard.NotNullOrEmpty(id); - Guard.NotNull(aggregateType); + Guard.NotNullOrEmpty(id, nameof(id)); + Guard.NotNull(aggregateType, nameof(aggregateType)); return $"{aggregateType.TypeName(true, Suffixes)}-{id}"; } public string WithNewId(string streamName, Func idGenerator) { - Guard.NotNullOrEmpty(streamName); - Guard.NotNull(idGenerator); + Guard.NotNullOrEmpty(streamName, nameof(streamName)); + Guard.NotNull(idGenerator, nameof(idGenerator)); var positionOfDash = streamName.IndexOf('-'); diff --git a/backend/src/Squidex.Infrastructure/States/Persistence{TSnapshot,TKey}.cs b/backend/src/Squidex.Infrastructure/States/Persistence{TSnapshot,TKey}.cs index 0465294ef..d4d4d6dc9 100644 --- a/backend/src/Squidex.Infrastructure/States/Persistence{TSnapshot,TKey}.cs +++ b/backend/src/Squidex.Infrastructure/States/Persistence{TSnapshot,TKey}.cs @@ -144,7 +144,7 @@ namespace Squidex.Infrastructure.States public async Task WriteEventsAsync(IEnumerable> events) { - Guard.NotNull(events); + Guard.NotNull(events, nameof(events)); var eventArray = events.ToArray(); diff --git a/backend/src/Squidex.Infrastructure/States/Store.cs b/backend/src/Squidex.Infrastructure/States/Store.cs index 278df0a16..f4b4335c0 100644 --- a/backend/src/Squidex.Infrastructure/States/Store.cs +++ b/backend/src/Squidex.Infrastructure/States/Store.cs @@ -49,7 +49,7 @@ namespace Squidex.Infrastructure.States private IPersistence CreatePersistence(Type owner, TKey key, HandleEvent? applyEvent) { - Guard.NotNull(key); + Guard.NotNull(key, nameof(key)); var snapshotStore = GetSnapshotStore(); @@ -58,7 +58,7 @@ namespace Squidex.Infrastructure.States private IPersistence CreatePersistence(Type owner, TKey key, PersistenceMode mode, HandleSnapshot? applySnapshot, HandleEvent? applyEvent) { - Guard.NotNull(key); + Guard.NotNull(key, nameof(key)); var snapshotStore = GetSnapshotStore(); diff --git a/backend/src/Squidex.Infrastructure/StringExtensions.cs b/backend/src/Squidex.Infrastructure/StringExtensions.cs index 70319cc47..08c04fbe7 100644 --- a/backend/src/Squidex.Infrastructure/StringExtensions.cs +++ b/backend/src/Squidex.Infrastructure/StringExtensions.cs @@ -772,7 +772,7 @@ namespace Squidex.Infrastructure public static string BuildFullUrl(this string baseUrl, string path, bool trailingSlash = false) { - Guard.NotNull(path); + Guard.NotNull(path, nameof(path)); var url = $"{baseUrl.TrimEnd('/')}/{path.Trim('/')}"; @@ -789,7 +789,7 @@ namespace Squidex.Infrastructure public static string JoinNonEmpty(string separator, params string?[] parts) { - Guard.NotNull(separator); + Guard.NotNull(separator, nameof(separator)); if (parts == null || parts.Length == 0) { diff --git a/backend/src/Squidex.Infrastructure/Tasks/AsyncLocalCleaner.cs b/backend/src/Squidex.Infrastructure/Tasks/AsyncLocalCleaner.cs index f7127be20..c7a06d7c7 100644 --- a/backend/src/Squidex.Infrastructure/Tasks/AsyncLocalCleaner.cs +++ b/backend/src/Squidex.Infrastructure/Tasks/AsyncLocalCleaner.cs @@ -16,7 +16,7 @@ namespace Squidex.Infrastructure.Tasks public AsyncLocalCleaner(AsyncLocal asyncLocal) { - Guard.NotNull(asyncLocal); + Guard.NotNull(asyncLocal, nameof(asyncLocal)); this.asyncLocal = asyncLocal; } diff --git a/backend/src/Squidex.Infrastructure/Tasks/AsyncLockPool.cs b/backend/src/Squidex.Infrastructure/Tasks/AsyncLockPool.cs index 8ec96d9b6..6c8e99ba2 100644 --- a/backend/src/Squidex.Infrastructure/Tasks/AsyncLockPool.cs +++ b/backend/src/Squidex.Infrastructure/Tasks/AsyncLockPool.cs @@ -16,7 +16,7 @@ namespace Squidex.Infrastructure.Tasks public AsyncLockPool(int poolSize) { - Guard.GreaterThan(poolSize, 0); + Guard.GreaterThan(poolSize, 0, nameof(poolSize)); locks = new AsyncLock[poolSize]; @@ -28,7 +28,7 @@ namespace Squidex.Infrastructure.Tasks public Task LockAsync(object target) { - Guard.NotNull(target); + Guard.NotNull(target, nameof(target)); return locks[Math.Abs(target.GetHashCode() % locks.Length)].LockAsync(); } diff --git a/backend/src/Squidex.Infrastructure/Tasks/PartitionedActionBlock.cs b/backend/src/Squidex.Infrastructure/Tasks/PartitionedActionBlock.cs index 7b89f8e0d..18c26c6fc 100644 --- a/backend/src/Squidex.Infrastructure/Tasks/PartitionedActionBlock.cs +++ b/backend/src/Squidex.Infrastructure/Tasks/PartitionedActionBlock.cs @@ -40,10 +40,10 @@ namespace Squidex.Infrastructure.Tasks public PartitionedActionBlock(Func action, Func partitioner, ExecutionDataflowBlockOptions dataflowBlockOptions) { - Guard.NotNull(action); - Guard.NotNull(partitioner); - Guard.NotNull(dataflowBlockOptions); - Guard.GreaterThan(dataflowBlockOptions.MaxDegreeOfParallelism, 1); + Guard.NotNull(action, nameof(action)); + Guard.NotNull(partitioner, nameof(partitioner)); + Guard.NotNull(dataflowBlockOptions, nameof(dataflowBlockOptions)); + Guard.GreaterThan(dataflowBlockOptions.MaxDegreeOfParallelism, 1, nameof(dataflowBlockOptions.MaxDegreeOfParallelism)); workers = new ActionBlock[dataflowBlockOptions.MaxDegreeOfParallelism]; diff --git a/backend/src/Squidex.Infrastructure/Tasks/SingleThreadedDispatcher.cs b/backend/src/Squidex.Infrastructure/Tasks/SingleThreadedDispatcher.cs index d6f57a403..c37997e25 100644 --- a/backend/src/Squidex.Infrastructure/Tasks/SingleThreadedDispatcher.cs +++ b/backend/src/Squidex.Infrastructure/Tasks/SingleThreadedDispatcher.cs @@ -30,14 +30,14 @@ namespace Squidex.Infrastructure.Tasks public Task DispatchAsync(Func action) { - Guard.NotNull(action); + Guard.NotNull(action, nameof(action)); return block.SendAsync(action); } public Task DispatchAsync(Action action) { - Guard.NotNull(action); + Guard.NotNull(action, nameof(action)); return block.SendAsync(() => { action(); return Task.CompletedTask; }); } diff --git a/backend/src/Squidex.Infrastructure/Tasks/TaskExtensions.cs b/backend/src/Squidex.Infrastructure/Tasks/TaskExtensions.cs index 04e36f430..ef56f9c5c 100644 --- a/backend/src/Squidex.Infrastructure/Tasks/TaskExtensions.cs +++ b/backend/src/Squidex.Infrastructure/Tasks/TaskExtensions.cs @@ -36,7 +36,7 @@ namespace Squidex.Infrastructure.Tasks public static Func ToDefault(this Action action) { - Guard.NotNull(action); + Guard.NotNull(action, nameof(action)); return x => { @@ -48,7 +48,7 @@ namespace Squidex.Infrastructure.Tasks public static Func> ToDefault(this Func action) { - Guard.NotNull(action); + Guard.NotNull(action, nameof(action)); return async x => { @@ -60,7 +60,7 @@ namespace Squidex.Infrastructure.Tasks public static Func> ToAsync(this Func action) { - Guard.NotNull(action); + Guard.NotNull(action, nameof(action)); return x => { diff --git a/backend/src/Squidex.Infrastructure/Timers/CompletionTimer.cs b/backend/src/Squidex.Infrastructure/Timers/CompletionTimer.cs index ee865d5a2..61a93f7e8 100644 --- a/backend/src/Squidex.Infrastructure/Timers/CompletionTimer.cs +++ b/backend/src/Squidex.Infrastructure/Timers/CompletionTimer.cs @@ -23,8 +23,8 @@ namespace Squidex.Infrastructure.Timers public CompletionTimer(int delayInMs, Func callback, int initialDelay = 0) { - Guard.NotNull(callback); - Guard.GreaterThan(delayInMs, 0); + Guard.NotNull(callback, nameof(callback)); + Guard.GreaterThan(delayInMs, 0, nameof(delayInMs)); runTask = RunInternalAsync(delayInMs, initialDelay, callback); } diff --git a/backend/src/Squidex.Infrastructure/Translations/DeepLTranslator.cs b/backend/src/Squidex.Infrastructure/Translations/DeepLTranslator.cs index 461211e17..8ef01e764 100644 --- a/backend/src/Squidex.Infrastructure/Translations/DeepLTranslator.cs +++ b/backend/src/Squidex.Infrastructure/Translations/DeepLTranslator.cs @@ -38,8 +38,8 @@ namespace Squidex.Infrastructure.Translations public DeepLTranslator(IOptions deeplOptions, IJsonSerializer jsonSerializer) { - Guard.NotNull(deeplOptions); - Guard.NotNull(jsonSerializer); + Guard.NotNull(deeplOptions, nameof(deeplOptions)); + Guard.NotNull(jsonSerializer, nameof(jsonSerializer)); this.deeplOptions = deeplOptions.Value; diff --git a/backend/src/Squidex.Infrastructure/UsageTracking/ApiUsageTracker.cs b/backend/src/Squidex.Infrastructure/UsageTracking/ApiUsageTracker.cs index cdc8da5b4..727655a6a 100644 --- a/backend/src/Squidex.Infrastructure/UsageTracking/ApiUsageTracker.cs +++ b/backend/src/Squidex.Infrastructure/UsageTracking/ApiUsageTracker.cs @@ -93,7 +93,7 @@ namespace Squidex.Infrastructure.UsageTracking private static string GetKey(string key) { - Guard.NotNullOrEmpty(key); + Guard.NotNullOrEmpty(key, nameof(key)); return $"{key}_API"; } diff --git a/backend/src/Squidex.Infrastructure/UsageTracking/BackgroundUsageTracker.cs b/backend/src/Squidex.Infrastructure/UsageTracking/BackgroundUsageTracker.cs index 52b674b9b..a1ac083db 100644 --- a/backend/src/Squidex.Infrastructure/UsageTracking/BackgroundUsageTracker.cs +++ b/backend/src/Squidex.Infrastructure/UsageTracking/BackgroundUsageTracker.cs @@ -29,8 +29,8 @@ namespace Squidex.Infrastructure.UsageTracking public BackgroundUsageTracker(IUsageRepository usageRepository, ISemanticLog log) { - Guard.NotNull(usageRepository); - Guard.NotNull(log); + Guard.NotNull(usageRepository, nameof(usageRepository)); + Guard.NotNull(log, nameof(log)); this.usageRepository = usageRepository; @@ -88,8 +88,8 @@ namespace Squidex.Infrastructure.UsageTracking public Task TrackAsync(DateTime date, string key, string? category, Counters counters) { - Guard.NotNullOrEmpty(key); - Guard.NotNull(counters); + Guard.NotNullOrEmpty(key, nameof(key)); + Guard.NotNull(counters, nameof(counters)); ThrowIfDisposed(); @@ -102,7 +102,7 @@ namespace Squidex.Infrastructure.UsageTracking public async Task>> QueryAsync(string key, DateTime fromDate, DateTime toDate) { - Guard.NotNullOrEmpty(key); + Guard.NotNullOrEmpty(key, nameof(key)); ThrowIfDisposed(); @@ -151,7 +151,7 @@ namespace Squidex.Infrastructure.UsageTracking public async Task GetAsync(string key, DateTime fromDate, DateTime toDate) { - Guard.NotNullOrEmpty(key); + Guard.NotNullOrEmpty(key, nameof(key)); ThrowIfDisposed(); diff --git a/backend/src/Squidex.Infrastructure/UsageTracking/CachingUsageTracker.cs b/backend/src/Squidex.Infrastructure/UsageTracking/CachingUsageTracker.cs index 79bd09be9..882c37a90 100644 --- a/backend/src/Squidex.Infrastructure/UsageTracking/CachingUsageTracker.cs +++ b/backend/src/Squidex.Infrastructure/UsageTracking/CachingUsageTracker.cs @@ -21,28 +21,28 @@ namespace Squidex.Infrastructure.UsageTracking public CachingUsageTracker(IUsageTracker inner, IMemoryCache cache) : base(cache) { - Guard.NotNull(inner); + Guard.NotNull(inner, nameof(inner)); this.inner = inner; } public Task>> QueryAsync(string key, DateTime fromDate, DateTime toDate) { - Guard.NotNull(key); + Guard.NotNull(key, nameof(key)); return inner.QueryAsync(key, fromDate, toDate); } public Task TrackAsync(DateTime date, string key, string? category, Counters counters) { - Guard.NotNull(key); + Guard.NotNull(key, nameof(key)); return inner.TrackAsync(date, key, category, counters); } public Task GetForMonthAsync(string key, DateTime date) { - Guard.NotNull(key); + Guard.NotNull(key, nameof(key)); var cacheKey = string.Join("$", "Usage", nameof(GetForMonthAsync), key, date); @@ -56,7 +56,7 @@ namespace Squidex.Infrastructure.UsageTracking public Task GetAsync(string key, DateTime fromDate, DateTime toDate) { - Guard.NotNull(key); + Guard.NotNull(key, nameof(key)); var cacheKey = string.Join("$", "Usage", nameof(GetAsync), key, fromDate, toDate); diff --git a/backend/src/Squidex.Infrastructure/UsageTracking/StoredUsage.cs b/backend/src/Squidex.Infrastructure/UsageTracking/StoredUsage.cs index 682c48577..d6b3beaa2 100644 --- a/backend/src/Squidex.Infrastructure/UsageTracking/StoredUsage.cs +++ b/backend/src/Squidex.Infrastructure/UsageTracking/StoredUsage.cs @@ -19,7 +19,7 @@ namespace Squidex.Infrastructure.UsageTracking public StoredUsage(string? category, DateTime date, Counters counters) { - Guard.NotNull(counters); + Guard.NotNull(counters, nameof(counters)); Category = category; Counters = counters; diff --git a/backend/src/Squidex.Infrastructure/Validation/ValidationError.cs b/backend/src/Squidex.Infrastructure/Validation/ValidationError.cs index 7de0d81ef..21db20f6c 100644 --- a/backend/src/Squidex.Infrastructure/Validation/ValidationError.cs +++ b/backend/src/Squidex.Infrastructure/Validation/ValidationError.cs @@ -29,7 +29,7 @@ namespace Squidex.Infrastructure.Validation public ValidationError(string message, params string[] propertyNames) { - Guard.NotNullOrEmpty(message); + Guard.NotNullOrEmpty(message, nameof(message)); this.message = message; diff --git a/backend/src/Squidex.Shared/Permissions.cs b/backend/src/Squidex.Shared/Permissions.cs index 421ff6ecf..71ddc30e1 100644 --- a/backend/src/Squidex.Shared/Permissions.cs +++ b/backend/src/Squidex.Shared/Permissions.cs @@ -157,7 +157,7 @@ namespace Squidex.Shared public static Permission ForApp(string id, string app = Permission.Any, string schema = Permission.Any) { - Guard.NotNull(id); + Guard.NotNull(id, nameof(id)); return new Permission(id.Replace("{app}", app ?? Permission.Any).Replace("{name}", schema ?? Permission.Any)); } diff --git a/backend/src/Squidex.Shared/Users/ClientUser.cs b/backend/src/Squidex.Shared/Users/ClientUser.cs index 5958dc5de..88f840eff 100644 --- a/backend/src/Squidex.Shared/Users/ClientUser.cs +++ b/backend/src/Squidex.Shared/Users/ClientUser.cs @@ -20,7 +20,7 @@ namespace Squidex.Shared.Users public ClientUser(RefToken token) { - Guard.NotNull(token); + Guard.NotNull(token, nameof(token)); this.token = token; diff --git a/backend/src/Squidex.Web/ApiController.cs b/backend/src/Squidex.Web/ApiController.cs index 1beda4cb6..091d2745c 100644 --- a/backend/src/Squidex.Web/ApiController.cs +++ b/backend/src/Squidex.Web/ApiController.cs @@ -57,7 +57,7 @@ namespace Squidex.Web protected ApiController(ICommandBus commandBus) { - Guard.NotNull(commandBus); + Guard.NotNull(commandBus, nameof(commandBus)); CommandBus = commandBus; diff --git a/backend/src/Squidex.Web/ApiExceptionConverter.cs b/backend/src/Squidex.Web/ApiExceptionConverter.cs index bbc05f433..bf496b73e 100644 --- a/backend/src/Squidex.Web/ApiExceptionConverter.cs +++ b/backend/src/Squidex.Web/ApiExceptionConverter.cs @@ -36,7 +36,7 @@ namespace Squidex.Web public static (ErrorDto Error, bool WellKnown) ToErrorDto(this ProblemDetails problem, HttpContext? httpContext) { - Guard.NotNull(problem); + Guard.NotNull(problem, nameof(problem)); var error = new ErrorDto { Message = problem.Title, StatusCode = problem.Status }; @@ -47,7 +47,7 @@ namespace Squidex.Web public static (ErrorDto Error, bool WellKnown) ToErrorDto(this Exception exception, HttpContext? httpContext) { - Guard.NotNull(exception); + Guard.NotNull(exception, nameof(exception)); var result = CreateError(exception); diff --git a/backend/src/Squidex.Web/CommandMiddlewares/ETagCommandMiddleware.cs b/backend/src/Squidex.Web/CommandMiddlewares/ETagCommandMiddleware.cs index 6cd88ebb9..6227c7ce4 100644 --- a/backend/src/Squidex.Web/CommandMiddlewares/ETagCommandMiddleware.cs +++ b/backend/src/Squidex.Web/CommandMiddlewares/ETagCommandMiddleware.cs @@ -22,7 +22,7 @@ namespace Squidex.Web.CommandMiddlewares public ETagCommandMiddleware(IHttpContextAccessor httpContextAccessor) { - Guard.NotNull(httpContextAccessor); + Guard.NotNull(httpContextAccessor, nameof(httpContextAccessor)); this.httpContextAccessor = httpContextAccessor; } diff --git a/backend/src/Squidex.Web/CommandMiddlewares/EnrichWithActorCommandMiddleware.cs b/backend/src/Squidex.Web/CommandMiddlewares/EnrichWithActorCommandMiddleware.cs index 2218d0a1f..6d7e821fd 100644 --- a/backend/src/Squidex.Web/CommandMiddlewares/EnrichWithActorCommandMiddleware.cs +++ b/backend/src/Squidex.Web/CommandMiddlewares/EnrichWithActorCommandMiddleware.cs @@ -20,7 +20,7 @@ namespace Squidex.Web.CommandMiddlewares public EnrichWithActorCommandMiddleware(IHttpContextAccessor httpContextAccessor) { - Guard.NotNull(httpContextAccessor); + Guard.NotNull(httpContextAccessor, nameof(httpContextAccessor)); this.httpContextAccessor = httpContextAccessor; } diff --git a/backend/src/Squidex.Web/CommandMiddlewares/EnrichWithAppIdCommandMiddleware.cs b/backend/src/Squidex.Web/CommandMiddlewares/EnrichWithAppIdCommandMiddleware.cs index ac91bb164..1ff8a6ac3 100644 --- a/backend/src/Squidex.Web/CommandMiddlewares/EnrichWithAppIdCommandMiddleware.cs +++ b/backend/src/Squidex.Web/CommandMiddlewares/EnrichWithAppIdCommandMiddleware.cs @@ -21,7 +21,7 @@ namespace Squidex.Web.CommandMiddlewares public EnrichWithAppIdCommandMiddleware(IContextProvider contextProvider) { - Guard.NotNull(contextProvider); + Guard.NotNull(contextProvider, nameof(contextProvider)); this.contextProvider = contextProvider; } diff --git a/backend/src/Squidex.Web/CommandMiddlewares/EnrichWithSchemaIdCommandMiddleware.cs b/backend/src/Squidex.Web/CommandMiddlewares/EnrichWithSchemaIdCommandMiddleware.cs index 04bbb7748..1247447b0 100644 --- a/backend/src/Squidex.Web/CommandMiddlewares/EnrichWithSchemaIdCommandMiddleware.cs +++ b/backend/src/Squidex.Web/CommandMiddlewares/EnrichWithSchemaIdCommandMiddleware.cs @@ -24,8 +24,8 @@ namespace Squidex.Web.CommandMiddlewares public EnrichWithSchemaIdCommandMiddleware(IAppProvider appProvider, IActionContextAccessor actionContextAccessor) { - Guard.NotNull(appProvider); - Guard.NotNull(actionContextAccessor); + Guard.NotNull(appProvider, nameof(appProvider)); + Guard.NotNull(actionContextAccessor, nameof(actionContextAccessor)); this.appProvider = appProvider; diff --git a/backend/src/Squidex.Web/ContextProvider.cs b/backend/src/Squidex.Web/ContextProvider.cs index e56c8ae26..6d960b7eb 100644 --- a/backend/src/Squidex.Web/ContextProvider.cs +++ b/backend/src/Squidex.Web/ContextProvider.cs @@ -37,7 +37,7 @@ namespace Squidex.Web public ContextProvider(IHttpContextAccessor httpContextAccessor) { - Guard.NotNull(httpContextAccessor); + Guard.NotNull(httpContextAccessor, nameof(httpContextAccessor)); this.httpContextAccessor = httpContextAccessor; } diff --git a/backend/src/Squidex.Web/Deferred.cs b/backend/src/Squidex.Web/Deferred.cs index 9779689ca..7367c639d 100644 --- a/backend/src/Squidex.Web/Deferred.cs +++ b/backend/src/Squidex.Web/Deferred.cs @@ -27,14 +27,14 @@ namespace Squidex.Web public static Deferred Response(Func factory) { - Guard.NotNull(factory); + Guard.NotNull(factory, nameof(factory)); return new Deferred(() => Task.FromResult(factory())); } public static Deferred AsyncResponse(Func> factory) { - Guard.NotNull(factory); + Guard.NotNull(factory, nameof(factory)); return new Deferred(async () => (await factory())!); } diff --git a/backend/src/Squidex.Web/ExposedValues.cs b/backend/src/Squidex.Web/ExposedValues.cs index dbc5d6e9f..84eeaaf9b 100644 --- a/backend/src/Squidex.Web/ExposedValues.cs +++ b/backend/src/Squidex.Web/ExposedValues.cs @@ -21,8 +21,8 @@ namespace Squidex.Web public ExposedValues(ExposedConfiguration configured, IConfiguration configuration, Assembly? assembly = null) { - Guard.NotNull(configured); - Guard.NotNull(configuration); + Guard.NotNull(configured, nameof(configured)); + Guard.NotNull(configuration, nameof(configuration)); foreach (var kvp in configured) { diff --git a/backend/src/Squidex.Web/FileCallbackResult.cs b/backend/src/Squidex.Web/FileCallbackResult.cs index 0d200a3f8..1662cfdd8 100644 --- a/backend/src/Squidex.Web/FileCallbackResult.cs +++ b/backend/src/Squidex.Web/FileCallbackResult.cs @@ -30,7 +30,7 @@ namespace Squidex.Web public FileCallbackResult(string contentType, FileCallback callback) : base(contentType) { - Guard.NotNull(callback); + Guard.NotNull(callback, nameof(callback)); Callback = callback; } diff --git a/backend/src/Squidex.Web/Pipeline/ActionContextLogAppender.cs b/backend/src/Squidex.Web/Pipeline/ActionContextLogAppender.cs index e72d8eb22..ca1d05e3a 100644 --- a/backend/src/Squidex.Web/Pipeline/ActionContextLogAppender.cs +++ b/backend/src/Squidex.Web/Pipeline/ActionContextLogAppender.cs @@ -21,8 +21,8 @@ namespace Squidex.Web.Pipeline public ActionContextLogAppender(IActionContextAccessor actionContextAccessor, IHttpContextAccessor httpContextAccessor) { - Guard.NotNull(actionContextAccessor); - Guard.NotNull(httpContextAccessor); + Guard.NotNull(actionContextAccessor, nameof(actionContextAccessor)); + Guard.NotNull(httpContextAccessor, nameof(httpContextAccessor)); this.actionContextAccessor = actionContextAccessor; diff --git a/backend/src/Squidex.Web/Pipeline/ApiCostsFilter.cs b/backend/src/Squidex.Web/Pipeline/ApiCostsFilter.cs index 08a8e6e79..0946cd3d5 100644 --- a/backend/src/Squidex.Web/Pipeline/ApiCostsFilter.cs +++ b/backend/src/Squidex.Web/Pipeline/ApiCostsFilter.cs @@ -21,7 +21,7 @@ namespace Squidex.Web.Pipeline public ApiCostsFilter(UsageGate usageGate) { - Guard.NotNull(usageGate); + Guard.NotNull(usageGate, nameof(usageGate)); this.usageGate = usageGate; } diff --git a/backend/src/Squidex.Web/Pipeline/AppResolver.cs b/backend/src/Squidex.Web/Pipeline/AppResolver.cs index 70cb2127b..909bfd3b0 100644 --- a/backend/src/Squidex.Web/Pipeline/AppResolver.cs +++ b/backend/src/Squidex.Web/Pipeline/AppResolver.cs @@ -28,7 +28,7 @@ namespace Squidex.Web.Pipeline public AppResolver(IAppProvider appProvider) { - Guard.NotNull(appProvider); + Guard.NotNull(appProvider, nameof(appProvider)); this.appProvider = appProvider; } diff --git a/backend/src/Squidex.Web/Pipeline/CachingFilter.cs b/backend/src/Squidex.Web/Pipeline/CachingFilter.cs index 981ee5259..79a2f8180 100644 --- a/backend/src/Squidex.Web/Pipeline/CachingFilter.cs +++ b/backend/src/Squidex.Web/Pipeline/CachingFilter.cs @@ -24,8 +24,8 @@ namespace Squidex.Web.Pipeline public CachingFilter(CachingManager cachingManager, IOptions cachingOptions) { - Guard.NotNull(cachingManager); - Guard.NotNull(cachingOptions); + Guard.NotNull(cachingManager, nameof(cachingManager)); + Guard.NotNull(cachingOptions, nameof(cachingOptions)); this.cachingOptions = cachingOptions.Value; this.cachingManager = cachingManager; diff --git a/backend/src/Squidex.Web/Pipeline/CachingManager.cs b/backend/src/Squidex.Web/Pipeline/CachingManager.cs index f6eeec9b3..b4068e97a 100644 --- a/backend/src/Squidex.Web/Pipeline/CachingManager.cs +++ b/backend/src/Squidex.Web/Pipeline/CachingManager.cs @@ -172,8 +172,8 @@ namespace Squidex.Web.Pipeline public CachingManager(IHttpContextAccessor httpContextAccessor, IOptions cachingOptions) { - Guard.NotNull(httpContextAccessor); - Guard.NotNull(cachingOptions); + Guard.NotNull(httpContextAccessor, nameof(httpContextAccessor)); + Guard.NotNull(cachingOptions, nameof(cachingOptions)); this.httpContextAccessor = httpContextAccessor; @@ -187,7 +187,7 @@ namespace Squidex.Web.Pipeline public void Start(HttpContext httpContext) { - Guard.NotNull(httpContext); + Guard.NotNull(httpContext, nameof(httpContext)); int maxKeysSize = GetKeysSize(httpContext); @@ -247,7 +247,7 @@ namespace Squidex.Web.Pipeline public void Finish(HttpContext httpContext) { - Guard.NotNull(httpContext); + Guard.NotNull(httpContext, nameof(httpContext)); var cacheContext = httpContextAccessor.HttpContext.Features.Get(); diff --git a/backend/src/Squidex.Web/Pipeline/EnforceHttpsMiddleware.cs b/backend/src/Squidex.Web/Pipeline/EnforceHttpsMiddleware.cs index 27939d99c..c1c9bec44 100644 --- a/backend/src/Squidex.Web/Pipeline/EnforceHttpsMiddleware.cs +++ b/backend/src/Squidex.Web/Pipeline/EnforceHttpsMiddleware.cs @@ -19,7 +19,7 @@ namespace Squidex.Web.Pipeline public EnforceHttpsMiddleware(IOptions urlsOptions) { - Guard.NotNull(urlsOptions); + Guard.NotNull(urlsOptions, nameof(urlsOptions)); this.urlsOptions = urlsOptions.Value; } diff --git a/backend/src/Squidex.Web/Pipeline/LocalCacheMiddleware.cs b/backend/src/Squidex.Web/Pipeline/LocalCacheMiddleware.cs index 9498a5dd1..b9f050191 100644 --- a/backend/src/Squidex.Web/Pipeline/LocalCacheMiddleware.cs +++ b/backend/src/Squidex.Web/Pipeline/LocalCacheMiddleware.cs @@ -18,7 +18,7 @@ namespace Squidex.Web.Pipeline public LocalCacheMiddleware(ILocalCache localCache) { - Guard.NotNull(localCache); + Guard.NotNull(localCache, nameof(localCache)); this.localCache = localCache; } diff --git a/backend/src/Squidex.Web/Pipeline/RequestExceptionMiddleware.cs b/backend/src/Squidex.Web/Pipeline/RequestExceptionMiddleware.cs index c11e0da4b..2a4da249e 100644 --- a/backend/src/Squidex.Web/Pipeline/RequestExceptionMiddleware.cs +++ b/backend/src/Squidex.Web/Pipeline/RequestExceptionMiddleware.cs @@ -19,7 +19,7 @@ namespace Squidex.Web.Pipeline public RequestExceptionMiddleware(ISemanticLog log) { - Guard.NotNull(log); + Guard.NotNull(log, nameof(log)); this.log = log; } diff --git a/backend/src/Squidex.Web/Pipeline/RequestLogPerformanceMiddleware.cs b/backend/src/Squidex.Web/Pipeline/RequestLogPerformanceMiddleware.cs index dff21bd50..f8f5cce66 100644 --- a/backend/src/Squidex.Web/Pipeline/RequestLogPerformanceMiddleware.cs +++ b/backend/src/Squidex.Web/Pipeline/RequestLogPerformanceMiddleware.cs @@ -21,8 +21,8 @@ namespace Squidex.Web.Pipeline public RequestLogPerformanceMiddleware(IOptions requestLogOptions, ISemanticLog log) { - Guard.NotNull(requestLogOptions); - Guard.NotNull(log); + Guard.NotNull(requestLogOptions, nameof(requestLogOptions)); + Guard.NotNull(log, nameof(log)); this.requestLogOptions = requestLogOptions.Value; diff --git a/backend/src/Squidex.Web/Pipeline/SchemaResolver.cs b/backend/src/Squidex.Web/Pipeline/SchemaResolver.cs index c723cb4a0..fe9f90356 100644 --- a/backend/src/Squidex.Web/Pipeline/SchemaResolver.cs +++ b/backend/src/Squidex.Web/Pipeline/SchemaResolver.cs @@ -21,7 +21,7 @@ namespace Squidex.Web.Pipeline public SchemaResolver(IAppProvider appProvider) { - Guard.NotNull(appProvider); + Guard.NotNull(appProvider, nameof(appProvider)); this.appProvider = appProvider; } diff --git a/backend/src/Squidex.Web/Pipeline/UsageMiddleware.cs b/backend/src/Squidex.Web/Pipeline/UsageMiddleware.cs index 131f5eabd..24f993436 100644 --- a/backend/src/Squidex.Web/Pipeline/UsageMiddleware.cs +++ b/backend/src/Squidex.Web/Pipeline/UsageMiddleware.cs @@ -24,9 +24,9 @@ namespace Squidex.Web.Pipeline public UsageMiddleware(IAppLogStore log, IApiUsageTracker usageTracker, IClock clock) { - Guard.NotNull(log); - Guard.NotNull(usageTracker); - Guard.NotNull(clock); + Guard.NotNull(log, nameof(log)); + Guard.NotNull(usageTracker, nameof(usageTracker)); + Guard.NotNull(clock, nameof(clock)); this.log = log; diff --git a/backend/src/Squidex.Web/Resource.cs b/backend/src/Squidex.Web/Resource.cs index 76d9c62dd..9989a8441 100644 --- a/backend/src/Squidex.Web/Resource.cs +++ b/backend/src/Squidex.Web/Resource.cs @@ -51,9 +51,9 @@ namespace Squidex.Web public void AddLink(string rel, string method, string href, string? metadata = null) { - Guard.NotNullOrEmpty(rel); - Guard.NotNullOrEmpty(href); - Guard.NotNullOrEmpty(method); + Guard.NotNullOrEmpty(rel, nameof(rel)); + Guard.NotNullOrEmpty(href, nameof(href)); + Guard.NotNullOrEmpty(method, nameof(method)); Links[rel] = new ResourceLink { Href = href, Method = method, Metadata = metadata }; } diff --git a/backend/src/Squidex.Web/Services/UrlGenerator.cs b/backend/src/Squidex.Web/Services/UrlGenerator.cs index d0f85428c..4ae668c10 100644 --- a/backend/src/Squidex.Web/Services/UrlGenerator.cs +++ b/backend/src/Squidex.Web/Services/UrlGenerator.cs @@ -23,8 +23,8 @@ namespace Squidex.Web.Services public UrlGenerator(IOptions urlsOptions, IAssetFileStore assetFileStore, bool allowAssetSourceUrl) { - Guard.NotNull(assetFileStore); - Guard.NotNull(urlsOptions); + Guard.NotNull(assetFileStore, nameof(assetFileStore)); + Guard.NotNull(urlsOptions, nameof(urlsOptions)); this.assetFileStore = assetFileStore; diff --git a/backend/src/Squidex/Areas/Api/Controllers/Apps/Models/RoleDto.cs b/backend/src/Squidex/Areas/Api/Controllers/Apps/Models/RoleDto.cs index ff7387f38..5934268d8 100644 --- a/backend/src/Squidex/Areas/Api/Controllers/Apps/Models/RoleDto.cs +++ b/backend/src/Squidex/Areas/Api/Controllers/Apps/Models/RoleDto.cs @@ -71,7 +71,7 @@ namespace Squidex.Areas.Api.Controllers.Apps.Models public RoleDto WithLinks(Resources resources) { - var values = new { app = resources.App, name = Name }; + var values = new { app = resources.App, roleName = Name }; if (!IsDefaultRole) { diff --git a/backend/src/Squidex/Areas/Api/Controllers/Assets/Models/AssetContentQueryDto.cs b/backend/src/Squidex/Areas/Api/Controllers/Assets/Models/AssetContentQueryDto.cs index c50699708..91147ae6d 100644 --- a/backend/src/Squidex/Areas/Api/Controllers/Assets/Models/AssetContentQueryDto.cs +++ b/backend/src/Squidex/Areas/Api/Controllers/Assets/Models/AssetContentQueryDto.cs @@ -83,7 +83,7 @@ namespace Squidex.Areas.Api.Controllers.Assets.Models public ResizeOptions ToResizeOptions(IAssetEntity asset) { - Guard.NotNull(asset); + Guard.NotNull(asset, nameof(asset)); var result = SimpleMapper.Map(this, new ResizeOptions()); diff --git a/backend/src/Squidex/Areas/Api/Controllers/EventConsumers/Models/EventConsumerDto.cs b/backend/src/Squidex/Areas/Api/Controllers/EventConsumers/Models/EventConsumerDto.cs index 42ff70d9c..e1ac74e3f 100644 --- a/backend/src/Squidex/Areas/Api/Controllers/EventConsumers/Models/EventConsumerDto.cs +++ b/backend/src/Squidex/Areas/Api/Controllers/EventConsumers/Models/EventConsumerDto.cs @@ -34,7 +34,7 @@ namespace Squidex.Areas.Api.Controllers.EventConsumers.Models { if (resources.CanManageEvents) { - var values = new { name = Name }; + var values = new { consumerName = Name }; if (!IsResetting) { diff --git a/backend/src/Squidex/Areas/Api/Controllers/Rules/Models/RuleActionProcessor.cs b/backend/src/Squidex/Areas/Api/Controllers/Rules/Models/RuleActionProcessor.cs index 32d18dc5f..58e7e6efc 100644 --- a/backend/src/Squidex/Areas/Api/Controllers/Rules/Models/RuleActionProcessor.cs +++ b/backend/src/Squidex/Areas/Api/Controllers/Rules/Models/RuleActionProcessor.cs @@ -23,7 +23,7 @@ namespace Squidex.Areas.Api.Controllers.Rules.Models public RuleActionProcessor(RuleRegistry ruleRegistry) { - Guard.NotNull(ruleRegistry); + Guard.NotNull(ruleRegistry, nameof(ruleRegistry)); this.ruleRegistry = ruleRegistry; } diff --git a/backend/src/Squidex/Areas/IdentityServer/Config/LazyClientStore.cs b/backend/src/Squidex/Areas/IdentityServer/Config/LazyClientStore.cs index 86642263c..3d36fb6d6 100644 --- a/backend/src/Squidex/Areas/IdentityServer/Config/LazyClientStore.cs +++ b/backend/src/Squidex/Areas/IdentityServer/Config/LazyClientStore.cs @@ -40,10 +40,10 @@ namespace Squidex.Areas.IdentityServer.Config IOptions identityOptions, IAppProvider appProvider) { - Guard.NotNull(appProvider); - Guard.NotNull(identityOptions); - Guard.NotNull(serviceProvider); - Guard.NotNull(urlsOptions); + Guard.NotNull(appProvider, nameof(appProvider)); + Guard.NotNull(identityOptions, nameof(identityOptions)); + Guard.NotNull(serviceProvider, nameof(serviceProvider)); + Guard.NotNull(urlsOptions, nameof(urlsOptions)); this.serviceProvider = serviceProvider; diff --git a/backend/src/Squidex/Pipeline/Robots/RobotsTxtMiddleware.cs b/backend/src/Squidex/Pipeline/Robots/RobotsTxtMiddleware.cs index a75e32ded..92ed64692 100644 --- a/backend/src/Squidex/Pipeline/Robots/RobotsTxtMiddleware.cs +++ b/backend/src/Squidex/Pipeline/Robots/RobotsTxtMiddleware.cs @@ -18,7 +18,7 @@ namespace Squidex.Pipeline.Robots public RobotsTxtMiddleware(IOptions robotsTxtOptions) { - Guard.NotNull(robotsTxtOptions); + Guard.NotNull(robotsTxtOptions, nameof(robotsTxtOptions)); this.robotsTxtOptions = robotsTxtOptions.Value; } diff --git a/backend/tools/Migrate_01/RebuildRunner.cs b/backend/tools/Migrate_01/RebuildRunner.cs index bda1638d3..cb814172b 100644 --- a/backend/tools/Migrate_01/RebuildRunner.cs +++ b/backend/tools/Migrate_01/RebuildRunner.cs @@ -22,9 +22,9 @@ namespace Migrate_01 public RebuildRunner(Rebuilder rebuilder, IOptions rebuildOptions, PopulateGrainIndexes populateGrainIndexes) { - Guard.NotNull(rebuilder); - Guard.NotNull(rebuildOptions); - Guard.NotNull(populateGrainIndexes); + Guard.NotNull(rebuilder, nameof(rebuilder)); + Guard.NotNull(rebuildOptions, nameof(rebuildOptions)); + Guard.NotNull(populateGrainIndexes, nameof(populateGrainIndexes)); this.rebuilder = rebuilder; this.rebuildOptions = rebuildOptions.Value; diff --git a/frontend/package-lock.json b/frontend/package-lock.json index 92f295eb5..662ceabc1 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -2019,9 +2019,9 @@ } }, "caniuse-lite": { - "version": "1.0.30001035", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001035.tgz", - "integrity": "sha512-C1ZxgkuA4/bUEdMbU5WrGY4+UhMFFiXrgNAfxiMIqWgFTWfv/xsZCS2xEHT2LMq7xAZfuAnu6mcqyDl0ZR6wLQ==", + "version": "1.0.30001055", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001055.tgz", + "integrity": "sha512-MbwsBmKrBSKIWldfdIagO5OJWZclpJtS4h0Jrk/4HFrXJxTdVdH23Fd+xCiHriVGvYcWyW8mR/CPsYajlH8Iuw==", "dev": true }, "canonical-path": { diff --git a/frontend/package.json b/frontend/package.json index ce3d5b01a..bf2e3c98a 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -34,7 +34,7 @@ "date-fns": "2.11.0", "graphiql": "0.17.5", "graphql": "14.6.0", - "image-focus": "^1.1.0", + "image-focus": "1.1.0", "marked": "0.8.0", "mersenne-twister": "1.1.0", "mousetrap": "1.6.5", @@ -62,14 +62,14 @@ "@types/node": "13.7.4", "@types/react": "16.9.21", "@types/react-dom": "16.9.5", - "@types/tinymce": "^4.5.24", + "@types/tinymce": "4.5.24", "browserslist": "4.9.1", - "caniuse-lite": "1.0.30001035", + "caniuse-lite": "1.0.30001055", "circular-dependency-plugin": "5.2.0", "codelyzer": "5.2.1", "css-loader": "3.4.2", - "cssnano": "^4.1.10", - "entities": "^2.0.0", + "cssnano": "4.1.10", + "entities": "2.0.0", "file-loader": "6.0.0", "html-loader": "0.5.5", "html-webpack-plugin": "3.2.0", @@ -89,18 +89,18 @@ "mini-css-extract-plugin": "0.9.0", "node-sass": "4.13.1", "optimize-css-assets-webpack-plugin": "5.0.3", - "postcss-import": "^12.0.1", - "postcss-loader": "^3.0.0", - "postcss-preset-env": "^6.7.0", + "postcss-import": "12.0.1", + "postcss-loader": "3.0.0", + "postcss-preset-env": "6.7.0", "raw-loader": "4.0.0", - "resize-observer-polyfill": "^1.5.1", + "resize-observer-polyfill": "1.5.1", "rimraf": "3.0.2", "rxjs-tslint": "0.1.7", - "sass-lint": "^1.13.1", - "sass-lint-webpack": "^1.0.2", + "sass-lint": "1.13.1", + "sass-lint-webpack": "1.0.2", "sass-loader": "8.0.2", "style-loader": "1.1.3", - "sugarss": "^2.0.0", + "sugarss": "2.0.0", "terser-webpack-plugin": "2.3.5", "ts-loader": "6.2.1", "tsconfig-paths-webpack-plugin": "3.2.0",