diff --git a/extensions/Squidex.Extensions/Actions/Discourse/DiscourseActionHandler.cs b/extensions/Squidex.Extensions/Actions/Discourse/DiscourseActionHandler.cs
index cf5a32f4a..22e9131a1 100644
--- a/extensions/Squidex.Extensions/Actions/Discourse/DiscourseActionHandler.cs
+++ b/extensions/Squidex.Extensions/Actions/Discourse/DiscourseActionHandler.cs
@@ -11,7 +11,6 @@ using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json.Linq;
using Squidex.Domain.Apps.Core.HandleRules;
-using Squidex.Domain.Apps.Core.HandleRules.Actions.Utils;
using Squidex.Domain.Apps.Core.HandleRules.EnrichedEvents;
namespace Squidex.Extensions.Actions.Discourse
diff --git a/extensions/Squidex.Extensions/Actions/Fastly/FastlyActionHandler.cs b/extensions/Squidex.Extensions/Actions/Fastly/FastlyActionHandler.cs
index d3024cf5f..a663a7f74 100644
--- a/extensions/Squidex.Extensions/Actions/Fastly/FastlyActionHandler.cs
+++ b/extensions/Squidex.Extensions/Actions/Fastly/FastlyActionHandler.cs
@@ -9,7 +9,6 @@ using System;
using System.Net.Http;
using System.Threading.Tasks;
using Squidex.Domain.Apps.Core.HandleRules;
-using Squidex.Domain.Apps.Core.HandleRules.Actions.Utils;
using Squidex.Domain.Apps.Core.HandleRules.EnrichedEvents;
using Squidex.Infrastructure;
@@ -52,7 +51,7 @@ namespace Squidex.Extensions.Actions.Fastly
request.Headers.Add("Fastly-Key", job.FastlyApiKey);
- return await httpClient.OneWayRequestAsync(request, null);
+ return await httpClient.OneWayRequestAsync(request);
}
}
}
diff --git a/extensions/Squidex.Extensions/Actions/HttpHelper.cs b/extensions/Squidex.Extensions/Actions/HttpHelper.cs
index 183f72066..613c99cbc 100644
--- a/extensions/Squidex.Extensions/Actions/HttpHelper.cs
+++ b/extensions/Squidex.Extensions/Actions/HttpHelper.cs
@@ -10,7 +10,7 @@ using System.Net.Http;
using System.Threading.Tasks;
using Squidex.Infrastructure.Http;
-namespace Squidex.Domain.Apps.Core.HandleRules.Actions.Utils
+namespace Squidex.Extensions.Actions
{
public static class HttpHelper
{
diff --git a/extensions/Squidex.Extensions/Actions/Medium/MediumActionHandler.cs b/extensions/Squidex.Extensions/Actions/Medium/MediumActionHandler.cs
index 631e74e13..9e594c7ec 100644
--- a/extensions/Squidex.Extensions/Actions/Medium/MediumActionHandler.cs
+++ b/extensions/Squidex.Extensions/Actions/Medium/MediumActionHandler.cs
@@ -12,7 +12,6 @@ using System.Threading.Tasks;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using Squidex.Domain.Apps.Core.HandleRules;
-using Squidex.Domain.Apps.Core.HandleRules.Actions.Utils;
using Squidex.Domain.Apps.Core.HandleRules.EnrichedEvents;
using Squidex.Infrastructure.Http;
diff --git a/extensions/Squidex.Extensions/Actions/Prerender/PrerenderActionHandler.cs b/extensions/Squidex.Extensions/Actions/Prerender/PrerenderActionHandler.cs
index e569fc25b..e8c722490 100644
--- a/extensions/Squidex.Extensions/Actions/Prerender/PrerenderActionHandler.cs
+++ b/extensions/Squidex.Extensions/Actions/Prerender/PrerenderActionHandler.cs
@@ -11,7 +11,6 @@ using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json.Linq;
using Squidex.Domain.Apps.Core.HandleRules;
-using Squidex.Domain.Apps.Core.HandleRules.Actions.Utils;
using Squidex.Domain.Apps.Core.HandleRules.EnrichedEvents;
namespace Squidex.Extensions.Actions.Prerender
diff --git a/extensions/Squidex.Extensions/Actions/RuleActionAttribute.cs b/extensions/Squidex.Extensions/Actions/RuleActionAttribute.cs
index f26896b7b..c5fa0343f 100644
--- a/extensions/Squidex.Extensions/Actions/RuleActionAttribute.cs
+++ b/extensions/Squidex.Extensions/Actions/RuleActionAttribute.cs
@@ -9,7 +9,7 @@ using System;
namespace Squidex.Extensions.Actions
{
- [AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = false)]
+ [AttributeUsage(AttributeTargets.Class, Inherited = false)]
public sealed class RuleActionAttribute : Attribute
{
public string ReadMore { get; set; }
diff --git a/extensions/Squidex.Extensions/Actions/RuleActionHandlerAttribute.cs b/extensions/Squidex.Extensions/Actions/RuleActionHandlerAttribute.cs
index 7850afaf6..5da96ebf5 100644
--- a/extensions/Squidex.Extensions/Actions/RuleActionHandlerAttribute.cs
+++ b/extensions/Squidex.Extensions/Actions/RuleActionHandlerAttribute.cs
@@ -11,7 +11,7 @@ using Squidex.Infrastructure;
namespace Squidex.Extensions.Actions
{
- [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
+ [AttributeUsage(AttributeTargets.Class, Inherited = false)]
public sealed class RuleActionHandlerAttribute : Attribute
{
public Type HandlerType { get; }
diff --git a/extensions/Squidex.Extensions/Actions/Slack/SlackActionHandler.cs b/extensions/Squidex.Extensions/Actions/Slack/SlackActionHandler.cs
index 86fe77cc0..aeb40f32c 100644
--- a/extensions/Squidex.Extensions/Actions/Slack/SlackActionHandler.cs
+++ b/extensions/Squidex.Extensions/Actions/Slack/SlackActionHandler.cs
@@ -12,7 +12,6 @@ using System.Threading.Tasks;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using Squidex.Domain.Apps.Core.HandleRules;
-using Squidex.Domain.Apps.Core.HandleRules.Actions.Utils;
using Squidex.Domain.Apps.Core.HandleRules.EnrichedEvents;
using Squidex.Infrastructure;
diff --git a/extensions/Squidex.Extensions/Actions/Twitter/TweetActionHandler.cs b/extensions/Squidex.Extensions/Actions/Twitter/TweetActionHandler.cs
index 988611246..228d7196d 100644
--- a/extensions/Squidex.Extensions/Actions/Twitter/TweetActionHandler.cs
+++ b/extensions/Squidex.Extensions/Actions/Twitter/TweetActionHandler.cs
@@ -49,7 +49,7 @@ namespace Squidex.Extensions.Actions.Twitter
job.AccessToken,
job.AccessSecret);
- var response = await tokens.Statuses.UpdateAsync(status => job.Text);
+ await tokens.Statuses.UpdateAsync(status => job.Text);
return ($"Tweeted: {job.Text}", null);
}
diff --git a/extensions/Squidex.Extensions/Actions/WebhookAction/WebhookAction.cs b/extensions/Squidex.Extensions/Actions/Webhook/WebhookAction.cs
similarity index 99%
rename from extensions/Squidex.Extensions/Actions/WebhookAction/WebhookAction.cs
rename to extensions/Squidex.Extensions/Actions/Webhook/WebhookAction.cs
index 6830ec923..e2c260b11 100644
--- a/extensions/Squidex.Extensions/Actions/WebhookAction/WebhookAction.cs
+++ b/extensions/Squidex.Extensions/Actions/Webhook/WebhookAction.cs
@@ -16,7 +16,7 @@ namespace Squidex.Extensions.Actions.Webhook
[RuleAction(
IconImage = "",
IconColor = "#4bb958",
- Display = "Send Webhook",
+ Display = "Send webhook",
Description = "Send events like ContentPublished to your webhook.",
ReadMore = "https://en.wikipedia.org/wiki/Webhook")]
public sealed class WebhookAction : RuleAction
diff --git a/extensions/Squidex.Extensions/Actions/WebhookAction/WebhookActionHandler.cs b/extensions/Squidex.Extensions/Actions/Webhook/WebhookActionHandler.cs
similarity index 97%
rename from extensions/Squidex.Extensions/Actions/WebhookAction/WebhookActionHandler.cs
rename to extensions/Squidex.Extensions/Actions/Webhook/WebhookActionHandler.cs
index 1c81ce18b..4220820ea 100644
--- a/extensions/Squidex.Extensions/Actions/WebhookAction/WebhookActionHandler.cs
+++ b/extensions/Squidex.Extensions/Actions/Webhook/WebhookActionHandler.cs
@@ -10,7 +10,6 @@ using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using Squidex.Domain.Apps.Core.HandleRules;
-using Squidex.Domain.Apps.Core.HandleRules.Actions.Utils;
using Squidex.Domain.Apps.Core.HandleRules.EnrichedEvents;
using Squidex.Infrastructure;
diff --git a/src/Squidex.Domain.Apps.Core.Model/Apps/LanguagesConfig.cs b/src/Squidex.Domain.Apps.Core.Model/Apps/LanguagesConfig.cs
index 3dd412601..51003278f 100644
--- a/src/Squidex.Domain.Apps.Core.Model/Apps/LanguagesConfig.cs
+++ b/src/Squidex.Domain.Apps.Core.Model/Apps/LanguagesConfig.cs
@@ -110,13 +110,10 @@ namespace Squidex.Domain.Apps.Core.Apps
var newLanguages =
languages.Values.Where(x => x.Language != language)
- .Select(config =>
- {
- return new LanguageConfig(
- config.Language,
- config.IsOptional,
- config.LanguageFallbacks.Except(new[] { language }));
- })
+ .Select(config => new LanguageConfig(
+ config.Language,
+ config.IsOptional,
+ config.LanguageFallbacks.Except(new[] { language })))
.ToImmutableDictionary(x => x.Language);
var newMaster =
diff --git a/src/Squidex.Domain.Apps.Core.Model/Rules/Json/JsonRule.cs b/src/Squidex.Domain.Apps.Core.Model/Rules/Json/JsonRule.cs
index ce63262a9..8cf13f2a3 100644
--- a/src/Squidex.Domain.Apps.Core.Model/Rules/Json/JsonRule.cs
+++ b/src/Squidex.Domain.Apps.Core.Model/Rules/Json/JsonRule.cs
@@ -36,7 +36,7 @@ namespace Squidex.Domain.Apps.Core.Rules.Json
if (!IsEnabled)
{
- rule.Disable();
+ rule = rule.Disable();
}
return rule;
diff --git a/src/Squidex.Domain.Apps.Core.Model/Schemas/IField{T}.cs b/src/Squidex.Domain.Apps.Core.Model/Schemas/IField{T}.cs
index 07d387456..0430e72ec 100644
--- a/src/Squidex.Domain.Apps.Core.Model/Schemas/IField{T}.cs
+++ b/src/Squidex.Domain.Apps.Core.Model/Schemas/IField{T}.cs
@@ -7,7 +7,7 @@
namespace Squidex.Domain.Apps.Core.Schemas
{
- public interface IField : IField
+ public interface IField : IField
{
T Properties { get; }
}
diff --git a/src/Squidex.Domain.Apps.Core.Operations/ConvertContent/FieldConverters.cs b/src/Squidex.Domain.Apps.Core.Operations/ConvertContent/FieldConverters.cs
index a761dbd64..1f373f154 100644
--- a/src/Squidex.Domain.Apps.Core.Operations/ConvertContent/FieldConverters.cs
+++ b/src/Squidex.Domain.Apps.Core.Operations/ConvertContent/FieldConverters.cs
@@ -35,10 +35,7 @@ namespace Squidex.Domain.Apps.Core.ConvertContent
public static FieldConverter ExcludeHidden()
{
- return (data, field) =>
- {
- return field.IsHidden ? null : data;
- };
+ return (data, field) => field.IsHidden ? null : data;
}
public static FieldConverter ExcludeChangedTypes()
@@ -100,7 +97,6 @@ namespace Squidex.Domain.Apps.Core.ConvertContent
public static FieldConverter ResolveLanguages(LanguagesConfig config)
{
var codeForInvariant = InvariantPartitioning.Instance.Master.Key;
- var codeForMasterLanguage = config.Master.Language.Iso2Code;
return (data, field) =>
{
diff --git a/src/Squidex.Domain.Apps.Core.Operations/ConvertContent/ValueConverters.cs b/src/Squidex.Domain.Apps.Core.Operations/ConvertContent/ValueConverters.cs
index b6b15ad30..343077c38 100644
--- a/src/Squidex.Domain.Apps.Core.Operations/ConvertContent/ValueConverters.cs
+++ b/src/Squidex.Domain.Apps.Core.Operations/ConvertContent/ValueConverters.cs
@@ -50,10 +50,7 @@ namespace Squidex.Domain.Apps.Core.ConvertContent
public static ValueConverter ExcludeHidden()
{
- return (value, field) =>
- {
- return field.IsHidden ? Value.Unset : value;
- };
+ return (value, field) => field.IsHidden ? Value.Unset : value;
}
public static ValueConverter ExcludeChangedTypes()
diff --git a/src/Squidex.Domain.Apps.Core.Operations/ExtractReferenceIds/ReferencesExtractor.cs b/src/Squidex.Domain.Apps.Core.Operations/ExtractReferenceIds/ReferencesExtractor.cs
index 663f1f529..1f661ef9c 100644
--- a/src/Squidex.Domain.Apps.Core.Operations/ExtractReferenceIds/ReferencesExtractor.cs
+++ b/src/Squidex.Domain.Apps.Core.Operations/ExtractReferenceIds/ReferencesExtractor.cs
@@ -33,13 +33,13 @@ namespace Squidex.Domain.Apps.Core.ExtractReferenceIds
if (value is JArray items)
{
- foreach (JObject item in value)
+ foreach (JObject item in items)
{
foreach (var nestedField in field.Fields)
{
- if (item.TryGetValue(nestedField.Name, out var value))
+ if (item.TryGetValue(nestedField.Name, out var nestedValue))
{
- result.AddRange(nestedField.Accept(new ReferencesExtractor(value)));
+ result.AddRange(nestedField.Accept(new ReferencesExtractor(nestedValue)));
}
}
}
diff --git a/src/Squidex.Domain.Apps.Core.Operations/HandleRules/RuleActionHandler.cs b/src/Squidex.Domain.Apps.Core.Operations/HandleRules/RuleActionHandler.cs
index d0e6009b4..0143f1956 100644
--- a/src/Squidex.Domain.Apps.Core.Operations/HandleRules/RuleActionHandler.cs
+++ b/src/Squidex.Domain.Apps.Core.Operations/HandleRules/RuleActionHandler.cs
@@ -34,7 +34,7 @@ namespace Squidex.Domain.Apps.Core.HandleRules
protected virtual string ToPayloadJson(T @event)
{
- return formatter.ToPayload(@event).ToString();
+ return formatter.ToPayload(@event).ToString();
}
protected virtual string ToEnvelopeJson(EnrichedEvent @event)
@@ -44,7 +44,7 @@ namespace Squidex.Domain.Apps.Core.HandleRules
protected virtual JObject ToPayload(T @event)
{
- return formatter.ToPayload(@event);
+ return formatter.ToPayload(@event);
}
protected virtual JObject ToEnvelope(EnrichedEvent @event)
diff --git a/src/Squidex.Domain.Apps.Core.Operations/HandleRules/RuleEventFormatter.cs b/src/Squidex.Domain.Apps.Core.Operations/HandleRules/RuleEventFormatter.cs
index e1c757c65..895a722ae 100644
--- a/src/Squidex.Domain.Apps.Core.Operations/HandleRules/RuleEventFormatter.cs
+++ b/src/Squidex.Domain.Apps.Core.Operations/HandleRules/RuleEventFormatter.cs
@@ -97,13 +97,13 @@ namespace Squidex.Domain.Apps.Core.HandleRules
for (var j = 0; j < patterns.Count; j++)
{
- var (Pattern, Replacer) = patterns[j];
+ var (pattern, replacer) = patterns[j];
- if (test.StartsWith(Pattern, StringComparison.OrdinalIgnoreCase))
+ if (test.StartsWith(pattern, StringComparison.OrdinalIgnoreCase))
{
- sb.Append(Replacer(@event));
+ sb.Append(replacer(@event));
- current = current.Slice(Pattern.Length + 1);
+ current = current.Slice(pattern.Length + 1);
i = 0;
tested = true;
@@ -284,12 +284,12 @@ namespace Squidex.Domain.Apps.Core.HandleRules
return Undefined;
}
- if (value is JValue jValue && jValue != null)
+ if (value is JValue jValue)
{
return jValue.Value.ToString();
}
- return value?.ToString(Formatting.Indented) ?? Undefined;
+ return value.ToString(Formatting.Indented) ?? Undefined;
}
}
}
diff --git a/src/Squidex.Domain.Apps.Core.Operations/HandleRules/RuleService.cs b/src/Squidex.Domain.Apps.Core.Operations/HandleRules/RuleService.cs
index 58e862cc6..211c5d380 100644
--- a/src/Squidex.Domain.Apps.Core.Operations/HandleRules/RuleService.cs
+++ b/src/Squidex.Domain.Apps.Core.Operations/HandleRules/RuleService.cs
@@ -22,7 +22,6 @@ namespace Squidex.Domain.Apps.Core.HandleRules
{
public class RuleService
{
- private const string ContentPrefix = "Content";
private readonly Dictionary ruleActionHandlers;
private readonly Dictionary ruleTriggerHandlers;
private readonly TypeNameRegistry typeNameRegistry;
diff --git a/src/Squidex.Domain.Apps.Core.Operations/HandleRules/Triggers/AssetChangedTriggerHandler.cs b/src/Squidex.Domain.Apps.Core.Operations/HandleRules/Triggers/AssetChangedTriggerHandler.cs
index 22555b6e2..7df652e50 100644
--- a/src/Squidex.Domain.Apps.Core.Operations/HandleRules/Triggers/AssetChangedTriggerHandler.cs
+++ b/src/Squidex.Domain.Apps.Core.Operations/HandleRules/Triggers/AssetChangedTriggerHandler.cs
@@ -22,10 +22,10 @@ namespace Squidex.Domain.Apps.Core.HandleRules.Triggers
private static bool MatchsType(AssetChangedTrigger trigger, AssetEvent @event)
{
return
- (trigger.SendCreate && @event is AssetCreated) ||
- (trigger.SendUpdate && @event is AssetUpdated) ||
- (trigger.SendDelete && @event is AssetDeleted) ||
- (trigger.SendRename && @event is AssetRenamed);
+ trigger.SendCreate && @event is AssetCreated ||
+ trigger.SendUpdate && @event is AssetUpdated ||
+ trigger.SendDelete && @event is AssetDeleted ||
+ trigger.SendRename && @event is AssetRenamed;
}
}
}
diff --git a/src/Squidex.Domain.Apps.Core.Operations/HandleRules/Triggers/ContentChangedTriggerHandler.cs b/src/Squidex.Domain.Apps.Core.Operations/HandleRules/Triggers/ContentChangedTriggerHandler.cs
index a65ccbcc7..f03100f98 100644
--- a/src/Squidex.Domain.Apps.Core.Operations/HandleRules/Triggers/ContentChangedTriggerHandler.cs
+++ b/src/Squidex.Domain.Apps.Core.Operations/HandleRules/Triggers/ContentChangedTriggerHandler.cs
@@ -89,7 +89,7 @@ namespace Squidex.Domain.Apps.Core.HandleRules.Triggers
private static bool IsDelete(ContentChangedTriggerSchema schema, SchemaEvent @event)
{
- return (schema.SendDelete && @event is ContentDeleted);
+ return schema.SendDelete && @event is ContentDeleted;
}
}
}
diff --git a/src/Squidex.Domain.Apps.Core.Operations/Tags/TagNormalizer.cs b/src/Squidex.Domain.Apps.Core.Operations/Tags/TagNormalizer.cs
index 936101f77..8c44a398a 100644
--- a/src/Squidex.Domain.Apps.Core.Operations/Tags/TagNormalizer.cs
+++ b/src/Squidex.Domain.Apps.Core.Operations/Tags/TagNormalizer.cs
@@ -95,7 +95,7 @@ namespace Squidex.Domain.Apps.Core.Tags
{
var nestedObject = (JObject)value;
- if (nestedObject.TryGetValue(nestedField.Name, out var nestedArray))
+ if (nestedObject.TryGetValue(nestedField.Name, out _))
{
ExtractTags(partition.Value, values, arrays);
}
@@ -111,7 +111,7 @@ namespace Squidex.Domain.Apps.Core.Tags
}
}
- private static void ExtractTags(JToken token, HashSet values, List arrays)
+ private static void ExtractTags(JToken token, ISet values, ICollection arrays)
{
if (token is JArray jArray)
{
diff --git a/src/Squidex.Domain.Apps.Core.Operations/ValidateContent/Validators/FieldValidator.cs b/src/Squidex.Domain.Apps.Core.Operations/ValidateContent/Validators/FieldValidator.cs
index 2c8e4d680..97471857e 100644
--- a/src/Squidex.Domain.Apps.Core.Operations/ValidateContent/Validators/FieldValidator.cs
+++ b/src/Squidex.Domain.Apps.Core.Operations/ValidateContent/Validators/FieldValidator.cs
@@ -37,7 +37,7 @@ namespace Squidex.Domain.Apps.Core.ValidateContent.Validators
var tasks = new List();
- foreach (var validator in ValidatorsFactory.CreateValidators(field))
+ foreach (var validator in validators)
{
tasks.Add(validator.ValidateAsync(typedValue, context, addError));
}
diff --git a/src/Squidex.Domain.Apps.Core.Operations/ValidateContent/Validators/RequiredStringValidator.cs b/src/Squidex.Domain.Apps.Core.Operations/ValidateContent/Validators/RequiredStringValidator.cs
index eacbcdb79..2b5219448 100644
--- a/src/Squidex.Domain.Apps.Core.Operations/ValidateContent/Validators/RequiredStringValidator.cs
+++ b/src/Squidex.Domain.Apps.Core.Operations/ValidateContent/Validators/RequiredStringValidator.cs
@@ -28,7 +28,7 @@ namespace Squidex.Domain.Apps.Core.ValidateContent.Validators
var valueAsString = (string)value;
- if (valueAsString == null || (validateEmptyStrings && string.IsNullOrWhiteSpace(valueAsString)))
+ if (valueAsString == null || validateEmptyStrings && string.IsNullOrWhiteSpace(valueAsString))
{
addError(context.Path, "Field is required.");
}
diff --git a/src/Squidex.Domain.Apps.Entities.MongoDb/Assets/MongoAssetEntity.cs b/src/Squidex.Domain.Apps.Entities.MongoDb/Assets/MongoAssetEntity.cs
index 5d4e69f60..f553712c8 100644
--- a/src/Squidex.Domain.Apps.Entities.MongoDb/Assets/MongoAssetEntity.cs
+++ b/src/Squidex.Domain.Apps.Entities.MongoDb/Assets/MongoAssetEntity.cs
@@ -7,7 +7,6 @@
using System;
using System.Collections.Generic;
-using MongoDB.Bson;
using MongoDB.Bson.Serialization.Attributes;
using Squidex.Domain.Apps.Core.ValidateContent;
using Squidex.Domain.Apps.Entities.Assets;
diff --git a/src/Squidex.Domain.Apps.Entities.MongoDb/Assets/MongoAssetRepository.cs b/src/Squidex.Domain.Apps.Entities.MongoDb/Assets/MongoAssetRepository.cs
index 838249509..6c42283c8 100644
--- a/src/Squidex.Domain.Apps.Entities.MongoDb/Assets/MongoAssetRepository.cs
+++ b/src/Squidex.Domain.Apps.Entities.MongoDb/Assets/MongoAssetRepository.cs
@@ -52,7 +52,7 @@ namespace Squidex.Domain.Apps.Entities.MongoDb.Assets
{
query = query.AdjustToModel();
- var filter = FindExtensions.BuildFilter(query, appId);
+ var filter = query.BuildFilter(appId);
var contentCount = Collection.Find(filter).CountDocumentsAsync();
var contentItems =
diff --git a/src/Squidex.Domain.Apps.Entities.MongoDb/Contents/Extensions.cs b/src/Squidex.Domain.Apps.Entities.MongoDb/Contents/Extensions.cs
index ce085a1dc..c1f982348 100644
--- a/src/Squidex.Domain.Apps.Entities.MongoDb/Contents/Extensions.cs
+++ b/src/Squidex.Domain.Apps.Entities.MongoDb/Contents/Extensions.cs
@@ -7,6 +7,7 @@
using System;
using System.Collections.Generic;
+using System.Globalization;
using System.Linq;
using System.Text;
using Newtonsoft.Json.Linq;
@@ -54,7 +55,7 @@ namespace Squidex.Domain.Apps.Entities.MongoDb.Contents
{
if (text.Type == JTokenType.String)
{
- var value = text.ToString();
+ var value = text.ToString(CultureInfo.InvariantCulture);
if (value.Length < 1000)
{
diff --git a/src/Squidex.Domain.Apps.Entities.MongoDb/Contents/MongoContentDraftCollection.cs b/src/Squidex.Domain.Apps.Entities.MongoDb/Contents/MongoContentDraftCollection.cs
index ae894f6cf..15cdb7f32 100644
--- a/src/Squidex.Domain.Apps.Entities.MongoDb/Contents/MongoContentDraftCollection.cs
+++ b/src/Squidex.Domain.Apps.Entities.MongoDb/Contents/MongoContentDraftCollection.cs
@@ -100,7 +100,7 @@ namespace Squidex.Domain.Apps.Entities.MongoDb.Contents
{
var schema = await getSchema(contentEntity.IndexedAppId, contentEntity.IndexedSchemaId);
- contentEntity?.ParseData(schema.SchemaDef);
+ contentEntity.ParseData(schema.SchemaDef);
return (SimpleMapper.Map(contentEntity, new ContentState()), contentEntity.Version);
}
diff --git a/src/Squidex.Domain.Apps.Entities.MongoDb/Contents/Visitors/FindExtensions.cs b/src/Squidex.Domain.Apps.Entities.MongoDb/Contents/Visitors/FindExtensions.cs
index 8d84c4744..9f920d153 100644
--- a/src/Squidex.Domain.Apps.Entities.MongoDb/Contents/Visitors/FindExtensions.cs
+++ b/src/Squidex.Domain.Apps.Entities.MongoDb/Contents/Visitors/FindExtensions.cs
@@ -89,8 +89,6 @@ namespace Squidex.Domain.Apps.Entities.MongoDb.Contents.Visitors
}
}
- var propertyName = string.Join(".", propertyNames);
-
return result;
});
diff --git a/src/Squidex.Domain.Apps.Entities/Apps/BackupApps.cs b/src/Squidex.Domain.Apps.Entities/Apps/BackupApps.cs
index d285ed517..1537a6da2 100644
--- a/src/Squidex.Domain.Apps.Entities/Apps/BackupApps.cs
+++ b/src/Squidex.Domain.Apps.Entities/Apps/BackupApps.cs
@@ -76,7 +76,7 @@ namespace Squidex.Domain.Apps.Entities.Apps
await WriteSettingsAsync(writer, appId);
}
- public async override Task RestoreEventAsync(Envelope @event, Guid appId, BackupReader reader, RefToken actor)
+ public override async Task RestoreEventAsync(Envelope @event, Guid appId, BackupReader reader, RefToken actor)
{
switch (@event.Payload)
{
diff --git a/src/Squidex.Domain.Apps.Entities/Apps/Commands/CreateApp.cs b/src/Squidex.Domain.Apps.Entities/Apps/Commands/CreateApp.cs
index d4dc2528b..5a97ddd7f 100644
--- a/src/Squidex.Domain.Apps.Entities/Apps/Commands/CreateApp.cs
+++ b/src/Squidex.Domain.Apps.Entities/Apps/Commands/CreateApp.cs
@@ -6,11 +6,10 @@
// ==========================================================================
using System;
-using Squidex.Infrastructure.Commands;
namespace Squidex.Domain.Apps.Entities.Apps.Commands
{
- public sealed class CreateApp : AppCommand, IAggregateCommand
+ public sealed class CreateApp : AppCommand
{
public string Name { get; set; }
diff --git a/src/Squidex.Domain.Apps.Entities/Apps/Guards/GuardAppClients.cs b/src/Squidex.Domain.Apps.Entities/Apps/Guards/GuardAppClients.cs
index bced69cc1..68b6454e5 100644
--- a/src/Squidex.Domain.Apps.Entities/Apps/Guards/GuardAppClients.cs
+++ b/src/Squidex.Domain.Apps.Entities/Apps/Guards/GuardAppClients.cs
@@ -25,7 +25,7 @@ namespace Squidex.Domain.Apps.Entities.Apps.Guards
}
else if (clients.ContainsKey(command.Id))
{
- e($"A client with the same id already exists.");
+ e("A client with the same id already exists.");
}
});
}
diff --git a/src/Squidex.Domain.Apps.Entities/Apps/Indexes/AppsByNameIndexCommandMiddleware.cs b/src/Squidex.Domain.Apps.Entities/Apps/Indexes/AppsByNameIndexCommandMiddleware.cs
index 1722bc363..12117ceeb 100644
--- a/src/Squidex.Domain.Apps.Entities/Apps/Indexes/AppsByNameIndexCommandMiddleware.cs
+++ b/src/Squidex.Domain.Apps.Entities/Apps/Indexes/AppsByNameIndexCommandMiddleware.cs
@@ -61,7 +61,7 @@ namespace Squidex.Domain.Apps.Entities.Apps.Indexes
}
finally
{
- if (isReserved && createApp != null)
+ if (isReserved)
{
await index.RemoveReservationAsync(createApp.AppId, createApp.Name);
}
diff --git a/src/Squidex.Domain.Apps.Entities/Apps/Templates/CreateBlogCommandMiddleware.cs b/src/Squidex.Domain.Apps.Entities/Apps/Templates/CreateBlogCommandMiddleware.cs
index 99ddef8c3..1dbbee9db 100644
--- a/src/Squidex.Domain.Apps.Entities/Apps/Templates/CreateBlogCommandMiddleware.cs
+++ b/src/Squidex.Domain.Apps.Entities/Apps/Templates/CreateBlogCommandMiddleware.cs
@@ -64,7 +64,7 @@ namespace Squidex.Domain.Apps.Entities.Apps.Templates
await publish(new AttachClient { Id = "sample-client", AppId = appId });
}
- private async Task CreatePostsAsync(Func publish)
+ private static async Task CreatePostsAsync(Func publish)
{
var postsId = await CreatePostsSchemaAsync(publish);
@@ -83,7 +83,7 @@ namespace Squidex.Domain.Apps.Entities.Apps.Templates
});
}
- private async Task CreatePagesAsync(Func publish)
+ private static async Task CreatePagesAsync(Func publish)
{
var pagesId = await CreatePagesSchemaAsync(publish);
@@ -102,7 +102,7 @@ namespace Squidex.Domain.Apps.Entities.Apps.Templates
});
}
- private async Task> CreatePostsSchemaAsync(Func publish)
+ private static async Task> CreatePostsSchemaAsync(Func publish)
{
var schema =
SchemaBuilder.Create("Posts")
@@ -136,7 +136,7 @@ namespace Squidex.Domain.Apps.Entities.Apps.Templates
return schemaId;
}
- private async Task> CreatePagesSchemaAsync(Func publish)
+ private static async Task> CreatePagesSchemaAsync(Func publish)
{
var schema =
SchemaBuilder.Create("Pages")
diff --git a/src/Squidex.Domain.Apps.Entities/Apps/Templates/CreateIdentityCommandMiddleware.cs b/src/Squidex.Domain.Apps.Entities/Apps/Templates/CreateIdentityCommandMiddleware.cs
index 4c37269b9..9e244906f 100644
--- a/src/Squidex.Domain.Apps.Entities/Apps/Templates/CreateIdentityCommandMiddleware.cs
+++ b/src/Squidex.Domain.Apps.Entities/Apps/Templates/CreateIdentityCommandMiddleware.cs
@@ -70,7 +70,7 @@ namespace Squidex.Domain.Apps.Entities.Apps.Templates
await publish(new AttachClient { Id = "default", AppId = appId });
}
- private async Task> CreateAuthenticationSchemeSchemaAsync(Func publish)
+ private static async Task> CreateAuthenticationSchemeSchemaAsync(Func publish)
{
var schema =
SchemaBuilder.Create("Authentication Schemes")
@@ -95,7 +95,7 @@ namespace Squidex.Domain.Apps.Entities.Apps.Templates
return NamedId.Of(schema.SchemaId, schema.Name);
}
- private Task CreateClientsSchemaAsync(Func publish)
+ private static Task CreateClientsSchemaAsync(Func publish)
{
var schema =
SchemaBuilder.Create("Clients")
@@ -134,7 +134,7 @@ namespace Squidex.Domain.Apps.Entities.Apps.Templates
return publish(schema);
}
- private Task CreateSettingsSchemaAsync(Func publish)
+ private static Task CreateSettingsSchemaAsync(Func publish)
{
var schema =
SchemaBuilder.Create("Settings").Singleton()
@@ -191,7 +191,7 @@ namespace Squidex.Domain.Apps.Entities.Apps.Templates
return publish(schema);
}
- private async Task CreateUsersSchemaAsync(Func publish)
+ private static async Task CreateUsersSchemaAsync(Func publish)
{
var schema =
SchemaBuilder.Create("Users")
@@ -261,7 +261,7 @@ namespace Squidex.Domain.Apps.Entities.Apps.Templates
});
}
- private Task CreateApiResourcesSchemaAsync(Func publish)
+ private static Task CreateApiResourcesSchemaAsync(Func publish)
{
var schema =
SchemaBuilder.Create("API Resources")
@@ -282,7 +282,7 @@ namespace Squidex.Domain.Apps.Entities.Apps.Templates
return publish(schema);
}
- private Task CreateIdentityResourcesSchemaAsync(Func publish)
+ private static Task CreateIdentityResourcesSchemaAsync(Func publish)
{
var schema =
SchemaBuilder.Create("Identity Resources")
diff --git a/src/Squidex.Domain.Apps.Entities/Apps/Templates/CreateProfileCommandMiddleware.cs b/src/Squidex.Domain.Apps.Entities/Apps/Templates/CreateProfileCommandMiddleware.cs
index fbdfc85c7..51c3e34ed 100644
--- a/src/Squidex.Domain.Apps.Entities/Apps/Templates/CreateProfileCommandMiddleware.cs
+++ b/src/Squidex.Domain.Apps.Entities/Apps/Templates/CreateProfileCommandMiddleware.cs
@@ -59,7 +59,7 @@ namespace Squidex.Domain.Apps.Entities.Apps.Templates
await publish(new AttachClient { Id = "sample-client", AppId = appId });
}
- private async Task CreateBasicsAsync(Func publish)
+ private static async Task CreateBasicsAsync(Func publish)
{
var postsId = await CreateBasicsSchemaAsync(publish);
@@ -81,7 +81,7 @@ namespace Squidex.Domain.Apps.Entities.Apps.Templates
});
}
- private async Task> CreateBasicsSchemaAsync(Func publish)
+ private static async Task> CreateBasicsSchemaAsync(Func publish)
{
var command =
SchemaBuilder.Create("basics")
@@ -123,7 +123,7 @@ namespace Squidex.Domain.Apps.Entities.Apps.Templates
return NamedId.Of(command.SchemaId, command.Name);
}
- private async Task> CreateProjectsSchemaAsync(Func publish)
+ private static async Task> CreateProjectsSchemaAsync(Func publish)
{
var schema =
SchemaBuilder.Create("projects")
@@ -153,7 +153,7 @@ namespace Squidex.Domain.Apps.Entities.Apps.Templates
return NamedId.Of(schema.SchemaId, schema.Name);
}
- private async Task> CreateExperienceSchemaAsync(Func publish)
+ private static async Task> CreateExperienceSchemaAsync(Func publish)
{
var schema =
SchemaBuilder.Create("experience")
@@ -180,7 +180,7 @@ namespace Squidex.Domain.Apps.Entities.Apps.Templates
return NamedId.Of(schema.SchemaId, schema.Name);
}
- private async Task> CreateEducationSchemaAsync(Func publish)
+ private static async Task> CreateEducationSchemaAsync(Func publish)
{
var schema =
SchemaBuilder.Create("Experience")
@@ -207,7 +207,7 @@ namespace Squidex.Domain.Apps.Entities.Apps.Templates
return NamedId.Of(schema.SchemaId, schema.Name);
}
- private async Task> CreatePublicationsSchemaAsync(Func publish)
+ private static async Task> CreatePublicationsSchemaAsync(Func publish)
{
var command =
SchemaBuilder.Create("Publications")
@@ -229,7 +229,7 @@ namespace Squidex.Domain.Apps.Entities.Apps.Templates
return NamedId.Of(command.SchemaId, command.Name);
}
- private async Task> CreateSkillsSchemaAsync(Func publish)
+ private static async Task> CreateSkillsSchemaAsync(Func publish)
{
var command =
SchemaBuilder.Create("Skills")
diff --git a/src/Squidex.Domain.Apps.Entities/Assets/AssetCommandMiddleware.cs b/src/Squidex.Domain.Apps.Entities/Assets/AssetCommandMiddleware.cs
index 2688ef256..5b605ac8b 100644
--- a/src/Squidex.Domain.Apps.Entities/Assets/AssetCommandMiddleware.cs
+++ b/src/Squidex.Domain.Apps.Entities/Assets/AssetCommandMiddleware.cs
@@ -40,7 +40,7 @@ namespace Squidex.Domain.Apps.Entities.Assets
this.tagGenerators = tagGenerators;
}
- public async override Task HandleAsync(CommandContext context, Func next)
+ public override async Task HandleAsync(CommandContext context, Func next)
{
switch (context.Command)
{
diff --git a/src/Squidex.Domain.Apps.Entities/Assets/AssetQueryService.cs b/src/Squidex.Domain.Apps.Entities/Assets/AssetQueryService.cs
index c041dfbec..f00f41a9d 100644
--- a/src/Squidex.Domain.Apps.Entities/Assets/AssetQueryService.cs
+++ b/src/Squidex.Domain.Apps.Entities/Assets/AssetQueryService.cs
@@ -74,7 +74,7 @@ namespace Squidex.Domain.Apps.Entities.Assets
return assets;
}
- private IResultList Sort(IResultList assets, IReadOnlyList ids)
+ private static IResultList Sort(IResultList assets, IReadOnlyList ids)
{
var sorted = ids.Select(id => assets.FirstOrDefault(x => x.Id == id)).Where(x => x != null);
@@ -106,7 +106,7 @@ namespace Squidex.Domain.Apps.Entities.Assets
}
catch (NotSupportedException)
{
- throw new ValidationException($"OData operation is not supported.");
+ throw new ValidationException("OData operation is not supported.");
}
catch (ODataException ex)
{
diff --git a/src/Squidex.Domain.Apps.Entities/Assets/State/AssetState.cs b/src/Squidex.Domain.Apps.Entities/Assets/State/AssetState.cs
index defa18436..44693da64 100644
--- a/src/Squidex.Domain.Apps.Entities/Assets/State/AssetState.cs
+++ b/src/Squidex.Domain.Apps.Entities/Assets/State/AssetState.cs
@@ -18,7 +18,7 @@ using Squidex.Infrastructure.Reflection;
namespace Squidex.Domain.Apps.Entities.Assets.State
{
- public class AssetState : DomainObjectState, IAssetEntity, IAssetInfo
+ public class AssetState : DomainObjectState, IAssetEntity
{
[JsonProperty]
public NamedId AppId { get; set; }
diff --git a/src/Squidex.Domain.Apps.Entities/Backup/BackupReader.cs b/src/Squidex.Domain.Apps.Entities/Backup/BackupReader.cs
index cc49fe3e5..32b8faf10 100644
--- a/src/Squidex.Domain.Apps.Entities/Backup/BackupReader.cs
+++ b/src/Squidex.Domain.Apps.Entities/Backup/BackupReader.cs
@@ -11,7 +11,7 @@ using System.IO.Compression;
using System.Threading.Tasks;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
-using Squidex.Domain.Apps.Entities.Backup.Archive;
+using Squidex.Domain.Apps.Entities.Backup.Helpers;
using Squidex.Infrastructure;
using Squidex.Infrastructure.EventSourcing;
using Squidex.Infrastructure.States;
diff --git a/src/Squidex.Domain.Apps.Entities/Backup/BackupWriter.cs b/src/Squidex.Domain.Apps.Entities/Backup/BackupWriter.cs
index 920ae4641..fa0e793af 100644
--- a/src/Squidex.Domain.Apps.Entities/Backup/BackupWriter.cs
+++ b/src/Squidex.Domain.Apps.Entities/Backup/BackupWriter.cs
@@ -11,7 +11,7 @@ using System.IO.Compression;
using System.Threading.Tasks;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
-using Squidex.Domain.Apps.Entities.Backup.Archive;
+using Squidex.Domain.Apps.Entities.Backup.Helpers;
using Squidex.Infrastructure;
using Squidex.Infrastructure.EventSourcing;
diff --git a/src/Squidex.Domain.Apps.Entities/Backup/Helpers/ArchiveHelper.cs b/src/Squidex.Domain.Apps.Entities/Backup/Helpers/ArchiveHelper.cs
index 69de1724f..848c90bb2 100644
--- a/src/Squidex.Domain.Apps.Entities/Backup/Helpers/ArchiveHelper.cs
+++ b/src/Squidex.Domain.Apps.Entities/Backup/Helpers/ArchiveHelper.cs
@@ -7,7 +7,7 @@
using System;
-namespace Squidex.Domain.Apps.Entities.Backup.Archive
+namespace Squidex.Domain.Apps.Entities.Backup.Helpers
{
public static class ArchiveHelper
{
diff --git a/src/Squidex.Domain.Apps.Entities/Backup/RestoreGrain.cs b/src/Squidex.Domain.Apps.Entities/Backup/RestoreGrain.cs
index 134367e4b..89fb79273 100644
--- a/src/Squidex.Domain.Apps.Entities/Backup/RestoreGrain.cs
+++ b/src/Squidex.Domain.Apps.Entities/Backup/RestoreGrain.cs
@@ -9,13 +9,11 @@ using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using NodaTime;
-using Orleans;
using Squidex.Domain.Apps.Entities.Backup.Helpers;
using Squidex.Domain.Apps.Entities.Backup.State;
using Squidex.Domain.Apps.Events;
using Squidex.Domain.Apps.Events.Apps;
using Squidex.Infrastructure;
-using Squidex.Infrastructure.Assets;
using Squidex.Infrastructure.EventSourcing;
using Squidex.Infrastructure.Log;
using Squidex.Infrastructure.Orleans;
@@ -26,13 +24,11 @@ namespace Squidex.Domain.Apps.Entities.Backup
{
public sealed class RestoreGrain : GrainOfString, IRestoreGrain
{
- private readonly IAssetStore assetStore;
private readonly IBackupArchiveLocation backupArchiveLocation;
private readonly IClock clock;
private readonly IEnumerable handlers;
private readonly IEventStore eventStore;
private readonly IEventDataFormatter eventDataFormatter;
- private readonly IGrainFactory grainFactory;
private readonly ISemanticLog log;
private readonly IStreamNameResolver streamNameResolver;
private readonly IStore store;
@@ -45,35 +41,28 @@ namespace Squidex.Domain.Apps.Entities.Backup
get { return state.Job; }
}
- public RestoreGrain(
- IAssetStore assetStore,
- IBackupArchiveLocation backupArchiveLocation,
+ public RestoreGrain(IBackupArchiveLocation backupArchiveLocation,
IClock clock,
IEventStore eventStore,
IEventDataFormatter eventDataFormatter,
- IGrainFactory grainFactory,
IEnumerable handlers,
ISemanticLog log,
IStreamNameResolver streamNameResolver,
IStore store)
{
- Guard.NotNull(assetStore, nameof(assetStore));
Guard.NotNull(backupArchiveLocation, nameof(backupArchiveLocation));
Guard.NotNull(clock, nameof(clock));
Guard.NotNull(eventStore, nameof(eventStore));
Guard.NotNull(eventDataFormatter, nameof(eventDataFormatter));
- Guard.NotNull(grainFactory, nameof(grainFactory));
Guard.NotNull(handlers, nameof(handlers));
Guard.NotNull(store, nameof(store));
Guard.NotNull(streamNameResolver, nameof(streamNameResolver));
Guard.NotNull(log, nameof(log));
- this.assetStore = assetStore;
this.backupArchiveLocation = backupArchiveLocation;
this.clock = clock;
this.eventStore = eventStore;
this.eventDataFormatter = eventDataFormatter;
- this.grainFactory = grainFactory;
this.handlers = handlers;
this.store = store;
this.streamNameResolver = streamNameResolver;
@@ -218,7 +207,7 @@ namespace Squidex.Domain.Apps.Entities.Backup
Log("Failed with internal error");
}
- await CleanupAsync(ex);
+ await CleanupAsync();
CurrentJob.Status = JobStatus.Failed;
@@ -241,7 +230,7 @@ namespace Squidex.Domain.Apps.Entities.Backup
}
}
- private async Task CleanupAsync(Exception exception = null)
+ private async Task CleanupAsync()
{
await Safe.DeleteAsync(backupArchiveLocation, CurrentJob.Id, log);
@@ -265,7 +254,7 @@ namespace Squidex.Domain.Apps.Entities.Backup
private async Task ReadEventsAsync(BackupReader reader)
{
- await reader.ReadEventsAsync(streamNameResolver, async (storedEvent) =>
+ await reader.ReadEventsAsync(streamNameResolver, async storedEvent =>
{
var @event = eventDataFormatter.Parse(storedEvent.Data);
diff --git a/src/Squidex.Domain.Apps.Entities/Backup/TempFolderBackupArchiveLocation.cs b/src/Squidex.Domain.Apps.Entities/Backup/TempFolderBackupArchiveLocation.cs
index 7fb773874..699ec524a 100644
--- a/src/Squidex.Domain.Apps.Entities/Backup/TempFolderBackupArchiveLocation.cs
+++ b/src/Squidex.Domain.Apps.Entities/Backup/TempFolderBackupArchiveLocation.cs
@@ -38,7 +38,7 @@ namespace Squidex.Domain.Apps.Entities.Backup
private static string GetTempFile(Guid backupId)
{
- return Path.Combine(Path.GetTempPath(), backupId.ToString() + ".zip");
+ return Path.Combine(Path.GetTempPath(), backupId + ".zip");
}
}
}
diff --git a/src/Squidex.Domain.Apps.Entities/Contents/BackupContents.cs b/src/Squidex.Domain.Apps.Entities/Contents/BackupContents.cs
index 38b905248..bb15f28e4 100644
--- a/src/Squidex.Domain.Apps.Entities/Contents/BackupContents.cs
+++ b/src/Squidex.Domain.Apps.Entities/Contents/BackupContents.cs
@@ -9,7 +9,6 @@ using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Squidex.Domain.Apps.Entities.Backup;
-using Squidex.Domain.Apps.Entities.Contents.Repositories;
using Squidex.Domain.Apps.Entities.Contents.State;
using Squidex.Domain.Apps.Events.Contents;
using Squidex.Infrastructure;
@@ -22,16 +21,12 @@ namespace Squidex.Domain.Apps.Entities.Contents
public sealed class BackupContents : BackupHandlerWithStore
{
private readonly HashSet contentIds = new HashSet();
- private readonly IContentRepository contentRepository;
public override string Name { get; } = "Contents";
- public BackupContents(IStore store, IContentRepository contentRepository)
+ public BackupContents(IStore store)
: base(store)
{
- Guard.NotNull(contentRepository, nameof(contentRepository));
-
- this.contentRepository = contentRepository;
}
public override Task RestoreEventAsync(Envelope @event, Guid appId, BackupReader reader, RefToken actor)
diff --git a/src/Squidex.Domain.Apps.Entities/Contents/ContentGrain.cs b/src/Squidex.Domain.Apps.Entities/Contents/ContentGrain.cs
index 615d438de..e01f16486 100644
--- a/src/Squidex.Domain.Apps.Entities/Contents/ContentGrain.cs
+++ b/src/Squidex.Domain.Apps.Entities/Contents/ContentGrain.cs
@@ -66,13 +66,13 @@ namespace Squidex.Domain.Apps.Entities.Contents
GuardContent.CanCreate(ctx.Schema, c);
- await ctx.ExecuteScriptAndTransformAsync(x => x.ScriptCreate, "Create", c, c.Data, null);
+ await ctx.ExecuteScriptAndTransformAsync(x => x.ScriptCreate, "Create", c, c.Data);
await ctx.EnrichAsync(c.Data);
await ctx.ValidateAsync(c.Data);
if (c.Publish)
{
- await ctx.ExecuteScriptAsync(x => x.ScriptChange, "Published", c, c.Data, null);
+ await ctx.ExecuteScriptAsync(x => x.ScriptChange, "Published", c, c.Data);
}
Create(c);
@@ -117,7 +117,7 @@ namespace Squidex.Domain.Apps.Entities.Contents
}
else
{
- var reason = StatusChange.Published;
+ StatusChange reason;
if (c.Status == Status.Published)
{
diff --git a/src/Squidex.Domain.Apps.Entities/Contents/ContentOperationContext.cs b/src/Squidex.Domain.Apps.Entities/Contents/ContentOperationContext.cs
index 97e729321..5ca66b9ef 100644
--- a/src/Squidex.Domain.Apps.Entities/Contents/ContentOperationContext.cs
+++ b/src/Squidex.Domain.Apps.Entities/Contents/ContentOperationContext.cs
@@ -99,22 +99,14 @@ namespace Squidex.Domain.Apps.Entities.Contents
return TaskHelper.Done;
}
- private ScriptContext CreateScriptContext(object operation, ContentCommand command, NamedContentData data, NamedContentData oldData)
+ private static ScriptContext CreateScriptContext(object operation, ContentCommand command, NamedContentData data, NamedContentData oldData)
{
return new ScriptContext { ContentId = command.ContentId, OldData = oldData, Data = data, User = command.User, Operation = operation.ToString() };
}
private ValidationContext CreateValidationContext()
{
- return new ValidationContext(
- (contentIds, schemaId) =>
- {
- return QueryContentsAsync(schemaId, contentIds);
- },
- assetIds =>
- {
- return QueryAssetsAsync(assetIds);
- });
+ return new ValidationContext((contentIds, schemaId) => QueryContentsAsync(schemaId, contentIds), QueryAssetsAsync);
}
private async Task> QueryAssetsAsync(IEnumerable assetIds)
diff --git a/src/Squidex.Domain.Apps.Entities/Contents/ContentQueryService.cs b/src/Squidex.Domain.Apps.Entities/Contents/ContentQueryService.cs
index d250ba29a..10ad63b53 100644
--- a/src/Squidex.Domain.Apps.Entities/Contents/ContentQueryService.cs
+++ b/src/Squidex.Domain.Apps.Entities/Contents/ContentQueryService.cs
@@ -130,7 +130,7 @@ namespace Squidex.Domain.Apps.Entities.Contents
return ResultList.Create(contents.Total, transformed);
}
- private IResultList Sort(IResultList contents, IReadOnlyList ids)
+ private static IResultList Sort(IResultList contents, IReadOnlyList ids)
{
var sorted = ids.Select(id => contents.FirstOrDefault(x => x.Id == id)).Where(x => x != null);
@@ -171,7 +171,7 @@ namespace Squidex.Domain.Apps.Entities.Contents
}
}
- private IEnumerable GenerateConverters(QueryContext context, bool checkType)
+ private static IEnumerable GenerateConverters(QueryContext context, bool checkType)
{
if (!context.IsFrontendClient)
{
@@ -223,7 +223,7 @@ namespace Squidex.Domain.Apps.Entities.Contents
}
catch (NotSupportedException)
{
- throw new ValidationException($"OData operation is not supported.");
+ throw new ValidationException("OData operation is not supported.");
}
catch (ODataException ex)
{
diff --git a/src/Squidex.Domain.Apps.Entities/Contents/ContentSchedulerGrain.cs b/src/Squidex.Domain.Apps.Entities/Contents/ContentSchedulerGrain.cs
index 968b2d384..4f2f92982 100644
--- a/src/Squidex.Domain.Apps.Entities/Contents/ContentSchedulerGrain.cs
+++ b/src/Squidex.Domain.Apps.Entities/Contents/ContentSchedulerGrain.cs
@@ -99,7 +99,7 @@ namespace Squidex.Domain.Apps.Entities.Contents
private Task Dispatch(Func task)
{
- return Task.Factory.StartNew(() => task(), CancellationToken.None, TaskCreationOptions.None, scheduler ?? TaskScheduler.Default).Unwrap();
+ return Task.Factory.StartNew(task, CancellationToken.None, TaskCreationOptions.None, scheduler ?? TaskScheduler.Default).Unwrap();
}
}
}
diff --git a/src/Squidex.Domain.Apps.Entities/Contents/GraphQL/GraphQLModel.cs b/src/Squidex.Domain.Apps.Entities/Contents/GraphQL/GraphQLModel.cs
index e971d8b46..e35b346dc 100644
--- a/src/Squidex.Domain.Apps.Entities/Contents/GraphQL/GraphQLModel.cs
+++ b/src/Squidex.Domain.Apps.Entities/Contents/GraphQL/GraphQLModel.cs
@@ -12,7 +12,6 @@ using System.Threading.Tasks;
using GraphQL;
using GraphQL.Resolvers;
using GraphQL.Types;
-using Newtonsoft.Json.Linq;
using Squidex.Domain.Apps.Core;
using Squidex.Domain.Apps.Core.Schemas;
using Squidex.Domain.Apps.Entities.Apps;
@@ -38,7 +37,7 @@ namespace Squidex.Domain.Apps.Entities.Contents.GraphQL
private readonly IGraphType assetListType;
private readonly GraphQLSchema graphQLSchema;
- public bool CanGenerateAssetSourceUrl { get; private set; }
+ public bool CanGenerateAssetSourceUrl { get; }
public GraphQLModel(IAppEntity app, IEnumerable schemas, IGraphQLUrlGenerator urlGenerator)
{
@@ -79,11 +78,6 @@ namespace Squidex.Domain.Apps.Entities.Contents.GraphQL
}
}
- private static (IGraphType ResolveType, IFieldResolver Resolver) ResolveDefault(IGraphType type)
- {
- return (type, new FuncFieldResolver, object>(c => c.Source.GetOrDefault(c.FieldName)));
- }
-
public IFieldResolver ResolveAssetUrl()
{
var resolver = new FuncFieldResolver(c =>
@@ -156,7 +150,7 @@ namespace Squidex.Domain.Apps.Entities.Contents.GraphQL
return null;
}
- return schema != null ? contentDataTypes.GetOrAddNew(schema) : null;
+ return contentDataTypes.GetOrAddNew(schema);
}
public IGraphType GetContentType(Guid schemaId)
diff --git a/src/Squidex.Domain.Apps.Entities/Contents/GraphQL/Types/AssetsResultGraphType.cs b/src/Squidex.Domain.Apps.Entities/Contents/GraphQL/Types/AssetsResultGraphType.cs
index 3597bf76c..04671da20 100644
--- a/src/Squidex.Domain.Apps.Entities/Contents/GraphQL/Types/AssetsResultGraphType.cs
+++ b/src/Squidex.Domain.Apps.Entities/Contents/GraphQL/Types/AssetsResultGraphType.cs
@@ -17,14 +17,14 @@ namespace Squidex.Domain.Apps.Entities.Contents.GraphQL.Types
{
public AssetsResultGraphType(IGraphType assetType)
{
- Name = $"AssetResultDto";
+ Name = "AssetResultDto";
AddField(new FieldType
{
Name = "total",
ResolvedType = AllTypes.Int,
Resolver = Resolve(x => x.Total),
- Description = $"The total count of assets."
+ Description = "The total count of assets."
});
AddField(new FieldType
@@ -32,7 +32,7 @@ namespace Squidex.Domain.Apps.Entities.Contents.GraphQL.Types
Name = "items",
Resolver = Resolve(x => x),
ResolvedType = new ListGraphType(new NonNullGraphType(assetType)),
- Description = $"The assets."
+ Description = "The assets."
});
Description = "List of assets and total count of assets.";
diff --git a/src/Squidex.Domain.Apps.Entities/Contents/GraphQL/Types/NestedGraphType.cs b/src/Squidex.Domain.Apps.Entities/Contents/GraphQL/Types/NestedGraphType.cs
index 5bdc36b5d..b0dc095d2 100644
--- a/src/Squidex.Domain.Apps.Entities/Contents/GraphQL/Types/NestedGraphType.cs
+++ b/src/Squidex.Domain.Apps.Entities/Contents/GraphQL/Types/NestedGraphType.cs
@@ -22,7 +22,6 @@ namespace Squidex.Domain.Apps.Entities.Contents.GraphQL.Types
var schemaType = schema.TypeName();
var schemaName = schema.DisplayName();
- var fieldType = field.TypeName();
var fieldName = field.DisplayName();
Name = $"{schemaType}{fieldName}ChildDto";
diff --git a/src/Squidex.Domain.Apps.Entities/Contents/GraphQL/Types/QueryGraphTypeVisitor.cs b/src/Squidex.Domain.Apps.Entities/Contents/GraphQL/Types/QueryGraphTypeVisitor.cs
index f330b5844..fa1e34514 100644
--- a/src/Squidex.Domain.Apps.Entities/Contents/GraphQL/Types/QueryGraphTypeVisitor.cs
+++ b/src/Squidex.Domain.Apps.Entities/Contents/GraphQL/Types/QueryGraphTypeVisitor.cs
@@ -17,7 +17,7 @@ namespace Squidex.Domain.Apps.Entities.Contents.GraphQL.Types
public sealed class QueryGraphTypeVisitor : IFieldVisitor<(IGraphType ResolveType, ValueResolver Resolver)>
{
- private static readonly ValueResolver NoopResolver = new ValueResolver((value, c) => value);
+ private static readonly ValueResolver NoopResolver = (value, c) => value;
private readonly ISchemaEntity schema;
private readonly Func schemaResolver;
private readonly IGraphModel model;
diff --git a/src/Squidex.Domain.Apps.Entities/Rules/BackupRules.cs b/src/Squidex.Domain.Apps.Entities/Rules/BackupRules.cs
index 4700dc163..9585b9905 100644
--- a/src/Squidex.Domain.Apps.Entities/Rules/BackupRules.cs
+++ b/src/Squidex.Domain.Apps.Entities/Rules/BackupRules.cs
@@ -25,7 +25,6 @@ namespace Squidex.Domain.Apps.Entities.Rules
{
private readonly HashSet ruleIds = new HashSet();
private readonly IGrainFactory grainFactory;
- private readonly IRuleEventRepository ruleEventRepository;
public override string Name { get; } = "Rules";
@@ -36,8 +35,6 @@ namespace Squidex.Domain.Apps.Entities.Rules
Guard.NotNull(ruleEventRepository, nameof(ruleEventRepository));
this.grainFactory = grainFactory;
-
- this.ruleEventRepository = ruleEventRepository;
}
public override Task RestoreEventAsync(Envelope @event, Guid appId, BackupReader reader, RefToken actor)
@@ -55,7 +52,7 @@ namespace Squidex.Domain.Apps.Entities.Rules
return TaskHelper.Done;
}
- public async override Task RestoreAsync(Guid appId, BackupReader reader)
+ public override async Task RestoreAsync(Guid appId, BackupReader reader)
{
await RebuildManyAsync(ruleIds, id => RebuildAsync(id, (e, s) => s.Apply(e)));
diff --git a/src/Squidex.Domain.Apps.Entities/Rules/RuleDequeuerGrain.cs b/src/Squidex.Domain.Apps.Entities/Rules/RuleDequeuerGrain.cs
index 79b6726a9..7ec68c1ee 100644
--- a/src/Squidex.Domain.Apps.Entities/Rules/RuleDequeuerGrain.cs
+++ b/src/Squidex.Domain.Apps.Entities/Rules/RuleDequeuerGrain.cs
@@ -113,7 +113,7 @@ namespace Squidex.Domain.Apps.Entities.Rules
}
finally
{
- executing.TryRemove(@event.Id, out var value);
+ executing.TryRemove(@event.Id, out _);
}
}
diff --git a/src/Squidex.Domain.Apps.Entities/Schemas/BackupSchemas.cs b/src/Squidex.Domain.Apps.Entities/Schemas/BackupSchemas.cs
index 600d8e0e1..663120216 100644
--- a/src/Squidex.Domain.Apps.Entities/Schemas/BackupSchemas.cs
+++ b/src/Squidex.Domain.Apps.Entities/Schemas/BackupSchemas.cs
@@ -55,7 +55,7 @@ namespace Squidex.Domain.Apps.Entities.Schemas
return TaskHelper.Done;
}
- public async override Task RestoreAsync(Guid appId, BackupReader reader)
+ public override async Task RestoreAsync(Guid appId, BackupReader reader)
{
await RebuildManyAsync(schemaIds.Select(x => x.Id), id => RebuildAsync(id, (e, s) => s.Apply(e, fieldRegistry)));
diff --git a/src/Squidex.Domain.Apps.Entities/Schemas/Commands/SchemaCommand.cs b/src/Squidex.Domain.Apps.Entities/Schemas/Commands/SchemaCommand.cs
index 49bba3620..f23581c88 100644
--- a/src/Squidex.Domain.Apps.Entities/Schemas/Commands/SchemaCommand.cs
+++ b/src/Squidex.Domain.Apps.Entities/Schemas/Commands/SchemaCommand.cs
@@ -8,7 +8,7 @@
using System;
using Squidex.Infrastructure.Commands;
-namespace Squidex.Domain.Apps.Entities
+namespace Squidex.Domain.Apps.Entities.Schemas.Commands
{
public abstract class SchemaCommand : SquidexCommand, IAggregateCommand
{
diff --git a/src/Squidex.Domain.Apps.Entities/Schemas/Guards/GuardSchemaField.cs b/src/Squidex.Domain.Apps.Entities/Schemas/Guards/GuardSchemaField.cs
index aaeb7167c..7b7f6a313 100644
--- a/src/Squidex.Domain.Apps.Entities/Schemas/Guards/GuardSchemaField.cs
+++ b/src/Squidex.Domain.Apps.Entities/Schemas/Guards/GuardSchemaField.cs
@@ -42,7 +42,7 @@ namespace Squidex.Domain.Apps.Entities.Schemas.Guards
if (arrayField.FieldsByName.ContainsKey(command.Name))
{
- e($"A field with the same name already exists.");
+ e("A field with the same name already exists.");
}
}
else
@@ -54,7 +54,7 @@ namespace Squidex.Domain.Apps.Entities.Schemas.Guards
if (schema.FieldsByName.ContainsKey(command.Name))
{
- e($"A field with the same name already exists.");
+ e("A field with the same name already exists.");
}
}
});
diff --git a/src/Squidex.Domain.Apps.Entities/Schemas/SchemaGrain.cs b/src/Squidex.Domain.Apps.Entities/Schemas/SchemaGrain.cs
index 879282c22..9ffda0930 100644
--- a/src/Squidex.Domain.Apps.Entities/Schemas/SchemaGrain.cs
+++ b/src/Squidex.Domain.Apps.Entities/Schemas/SchemaGrain.cs
@@ -53,7 +53,7 @@ namespace Squidex.Domain.Apps.Entities.Schemas
Add(c);
- var id = 0L;
+ long id;
if (c.ParentFieldId == null)
{
diff --git a/src/Squidex.Domain.Apps.Entities/Schemas/State/SchemaState.cs b/src/Squidex.Domain.Apps.Entities/Schemas/State/SchemaState.cs
index 01bd7a7d1..fdec25995 100644
--- a/src/Squidex.Domain.Apps.Entities/Schemas/State/SchemaState.cs
+++ b/src/Squidex.Domain.Apps.Entities/Schemas/State/SchemaState.cs
@@ -32,7 +32,7 @@ namespace Squidex.Domain.Apps.Entities.Schemas.State
public string Category { get; set; }
[JsonProperty]
- public int TotalFields { get; set; } = 0;
+ public int TotalFields { get; set; }
[JsonProperty]
public bool IsDeleted { get; set; }
diff --git a/src/Squidex.Domain.Apps.Entities/Tags/ITagGenerator.cs b/src/Squidex.Domain.Apps.Entities/Tags/ITagGenerator.cs
index eac2b6f0a..504c85d53 100644
--- a/src/Squidex.Domain.Apps.Entities/Tags/ITagGenerator.cs
+++ b/src/Squidex.Domain.Apps.Entities/Tags/ITagGenerator.cs
@@ -9,7 +9,7 @@ using System.Collections.Generic;
namespace Squidex.Domain.Apps.Entities.Tags
{
- public interface ITagGenerator
+ public interface ITagGenerator
{
void GenerateTags(T source, HashSet tags);
}
diff --git a/src/Squidex.Domain.Users.MongoDb/MongoUserStore.cs b/src/Squidex.Domain.Users.MongoDb/MongoUserStore.cs
index d5da97586..686acd84d 100644
--- a/src/Squidex.Domain.Users.MongoDb/MongoUserStore.cs
+++ b/src/Squidex.Domain.Users.MongoDb/MongoUserStore.cs
@@ -390,7 +390,7 @@ namespace Squidex.Domain.Users.MongoDb
public async Task FindByIdOrEmailAsync(string id)
{
- if (ObjectId.TryParse(id, out var parsed))
+ if (ObjectId.TryParse(id, out _))
{
return await Collection.Find(x => x.Id == id).FirstOrDefaultAsync();
}
diff --git a/src/Squidex.Infrastructure.Azure/Assets/AzureBlobAssetStore.cs b/src/Squidex.Infrastructure.Azure/Assets/AzureBlobAssetStore.cs
index 628ebdf20..4239d2c4b 100644
--- a/src/Squidex.Infrastructure.Azure/Assets/AzureBlobAssetStore.cs
+++ b/src/Squidex.Infrastructure.Azure/Assets/AzureBlobAssetStore.cs
@@ -16,8 +16,6 @@ namespace Squidex.Infrastructure.Assets
{
public class AzureBlobAssetStore : IAssetStore, IInitializable
{
- private const string AssetVersion = "AssetVersion";
- private const string AssetId = "AssetId";
private readonly string containerName;
private readonly string connectionString;
private CloudBlobContainer blobContainer;
@@ -72,7 +70,7 @@ namespace Squidex.Infrastructure.Assets
{
ct.ThrowIfCancellationRequested();
- await Task.Delay(50);
+ await Task.Delay(50, ct);
await targetBlob.FetchAttributesAsync(null, null, null, ct);
}
diff --git a/src/Squidex.Infrastructure.GetEventStore/EventSourcing/GetEventStore.cs b/src/Squidex.Infrastructure.GetEventStore/EventSourcing/GetEventStore.cs
index 50722a41d..d948039e2 100644
--- a/src/Squidex.Infrastructure.GetEventStore/EventSourcing/GetEventStore.cs
+++ b/src/Squidex.Infrastructure.GetEventStore/EventSourcing/GetEventStore.cs
@@ -21,7 +21,7 @@ namespace Squidex.Infrastructure.EventSourcing
private const int ReadPageSize = 500;
private readonly IEventStoreConnection connection;
private readonly string prefix;
- private ProjectionClient projectionClient;
+ private readonly ProjectionClient projectionClient;
public GetEventStore(IEventStoreConnection connection, string prefix, string projectionHost)
{
@@ -50,7 +50,7 @@ namespace Squidex.Infrastructure.EventSourcing
public IEventSubscription CreateSubscription(IEventSubscriber subscriber, string streamFilter, string position = null)
{
- return new GetEventStoreSubscription(connection, subscriber, projectionClient, prefix, position, streamFilter);
+ return new GetEventStoreSubscription(connection, subscriber, projectionClient, position, streamFilter);
}
public Task CreateIndexAsync(string property)
@@ -82,9 +82,26 @@ namespace Squidex.Infrastructure.EventSourcing
}
}
- private Task QueryAsync(Func callback, string streamName, long sliceStart, CancellationToken ct)
+ private async Task QueryAsync(Func callback, string streamName, long sliceStart, CancellationToken ct)
{
- return QueryAsync(callback, GetStreamName(streamName), sliceStart, ct);
+ StreamEventsSlice currentSlice;
+ do
+ {
+ currentSlice = await connection.ReadStreamEventsForwardAsync(streamName, sliceStart, ReadPageSize, false);
+
+ if (currentSlice.Status == SliceReadStatus.Success)
+ {
+ sliceStart = currentSlice.NextEventNumber;
+
+ foreach (var resolved in currentSlice.Events)
+ {
+ var storedEvent = Formatter.Read(resolved);
+
+ await callback(storedEvent);
+ }
+ }
+ }
+ while (!currentSlice.IsEndOfStream && !ct.IsCancellationRequested);
}
public async Task> QueryAsync(string streamName, long streamPosition = 0)
diff --git a/src/Squidex.Infrastructure.GetEventStore/EventSourcing/GetEventStoreSubscription.cs b/src/Squidex.Infrastructure.GetEventStore/EventSourcing/GetEventStoreSubscription.cs
index ced196675..e77d4a204 100644
--- a/src/Squidex.Infrastructure.GetEventStore/EventSourcing/GetEventStoreSubscription.cs
+++ b/src/Squidex.Infrastructure.GetEventStore/EventSourcing/GetEventStoreSubscription.cs
@@ -23,7 +23,6 @@ namespace Squidex.Infrastructure.EventSourcing
IEventStoreConnection connection,
IEventSubscriber subscriber,
ProjectionClient projectionClient,
- string prefix,
string position,
string streamFilter)
{
diff --git a/src/Squidex.Infrastructure.MongoDb/Assets/MongoGridFsAssetStore.cs b/src/Squidex.Infrastructure.MongoDb/Assets/MongoGridFsAssetStore.cs
index faadf950a..15dc5619b 100644
--- a/src/Squidex.Infrastructure.MongoDb/Assets/MongoGridFsAssetStore.cs
+++ b/src/Squidex.Infrastructure.MongoDb/Assets/MongoGridFsAssetStore.cs
@@ -69,7 +69,7 @@ namespace Squidex.Infrastructure.Assets
using (var readStream = await bucket.OpenDownloadStreamAsync(name, cancellationToken: ct))
{
- await readStream.CopyToAsync(stream, BufferSize);
+ await readStream.CopyToAsync(stream, BufferSize, ct);
}
}
catch (GridFSFileNotFoundException ex)
diff --git a/src/Squidex.Infrastructure.MongoDb/EventSourcing/MongoEventStore_Writer.cs b/src/Squidex.Infrastructure.MongoDb/EventSourcing/MongoEventStore_Writer.cs
index af4b0172a..4e77f4991 100644
--- a/src/Squidex.Infrastructure.MongoDb/EventSourcing/MongoEventStore_Writer.cs
+++ b/src/Squidex.Infrastructure.MongoDb/EventSourcing/MongoEventStore_Writer.cs
@@ -7,7 +7,6 @@
using System;
using System.Collections.Generic;
-using System.Reactive.Linq;
using System.Threading.Tasks;
using MongoDB.Bson;
using MongoDB.Driver;
diff --git a/src/Squidex.Infrastructure.MongoDb/MongoDb/BsonJsonConverter.cs b/src/Squidex.Infrastructure.MongoDb/MongoDb/BsonJsonConverter.cs
index 4c35c5377..e9aa9d8cc 100644
--- a/src/Squidex.Infrastructure.MongoDb/MongoDb/BsonJsonConverter.cs
+++ b/src/Squidex.Infrastructure.MongoDb/MongoDb/BsonJsonConverter.cs
@@ -85,11 +85,11 @@ namespace Squidex.Infrastructure.MongoDb
case JTokenType.Bytes:
return BsonValue.Create(((JValue)source).Value);
case JTokenType.Guid:
- return BsonValue.Create(((JValue)source).ToString());
+ return BsonValue.Create(((JValue)source).ToString(CultureInfo.InvariantCulture));
case JTokenType.Uri:
- return BsonValue.Create(((JValue)source).ToString());
+ return BsonValue.Create(((JValue)source).ToString(CultureInfo.InvariantCulture));
case JTokenType.TimeSpan:
- return BsonValue.Create(((JValue)source).ToString());
+ return BsonValue.Create(((JValue)source).ToString(CultureInfo.InvariantCulture));
case JTokenType.Date:
{
var value = ((JValue)source).Value;
diff --git a/src/Squidex.Infrastructure.MongoDb/MongoDb/OData/FilterVisitor.cs b/src/Squidex.Infrastructure.MongoDb/MongoDb/OData/FilterVisitor.cs
index bc26029dd..adcc9bc4b 100644
--- a/src/Squidex.Infrastructure.MongoDb/MongoDb/OData/FilterVisitor.cs
+++ b/src/Squidex.Infrastructure.MongoDb/MongoDb/OData/FilterVisitor.cs
@@ -42,8 +42,6 @@ namespace Squidex.Infrastructure.MongoDb.OData
{
return Filter.Or(nodeIn.Operands.Select(x => x.Accept(this)));
}
-
- throw new NotSupportedException();
}
public override FilterDefinition Visit(FilterComparison nodeIn)
@@ -75,7 +73,7 @@ namespace Squidex.Infrastructure.MongoDb.OData
throw new NotSupportedException();
}
- private BsonRegularExpression BuildRegex(FilterComparison node, Func formatter)
+ private static BsonRegularExpression BuildRegex(FilterComparison node, Func formatter)
{
return new BsonRegularExpression(formatter(node.Value.ToString()), "i");
}
diff --git a/src/Squidex.Infrastructure.MongoDb/States/MongoSnapshotStore.cs b/src/Squidex.Infrastructure.MongoDb/States/MongoSnapshotStore.cs
index 67e593b53..d4c7a0b8c 100644
--- a/src/Squidex.Infrastructure.MongoDb/States/MongoSnapshotStore.cs
+++ b/src/Squidex.Infrastructure.MongoDb/States/MongoSnapshotStore.cs
@@ -9,22 +9,16 @@ using System.Linq;
using System.Threading.Tasks;
using MongoDB.Bson;
using MongoDB.Driver;
-using Newtonsoft.Json;
using Squidex.Infrastructure.Log;
using Squidex.Infrastructure.MongoDb;
namespace Squidex.Infrastructure.States
{
- public class MongoSnapshotStore : MongoRepositoryBase>, ISnapshotStore, IInitializable
+ public class MongoSnapshotStore : MongoRepositoryBase>, ISnapshotStore
{
- private readonly JsonSerializer serializer;
-
- public MongoSnapshotStore(IMongoDatabase database, JsonSerializer serializer)
+ public MongoSnapshotStore(IMongoDatabase database)
: base(database)
{
- Guard.NotNull(serializer, nameof(serializer));
-
- this.serializer = serializer;
}
protected override string CollectionName()
diff --git a/src/Squidex.Infrastructure.RabbitMq/CQRS/Events/RabbitMqEventConsumer.cs b/src/Squidex.Infrastructure.RabbitMq/CQRS/Events/RabbitMqEventConsumer.cs
index a33c28cc9..979a66208 100644
--- a/src/Squidex.Infrastructure.RabbitMq/CQRS/Events/RabbitMqEventConsumer.cs
+++ b/src/Squidex.Infrastructure.RabbitMq/CQRS/Events/RabbitMqEventConsumer.cs
@@ -10,9 +10,10 @@ using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
using RabbitMQ.Client;
+using Squidex.Infrastructure.EventSourcing;
using Squidex.Infrastructure.Tasks;
-namespace Squidex.Infrastructure.EventSourcing
+namespace Squidex.Infrastructure.CQRS.Events
{
public sealed class RabbitMqEventConsumer : DisposableObjectBase, IInitializable, IEventConsumer
{
diff --git a/src/Squidex.Infrastructure/Assets/FolderAssetStore.cs b/src/Squidex.Infrastructure/Assets/FolderAssetStore.cs
index 8bcda3ac6..e86c5dd84 100644
--- a/src/Squidex.Infrastructure/Assets/FolderAssetStore.cs
+++ b/src/Squidex.Infrastructure/Assets/FolderAssetStore.cs
@@ -125,7 +125,7 @@ namespace Squidex.Infrastructure.Assets
return TaskHelper.Done;
}
- private async Task UploadCoreAsync(FileInfo file, Stream stream, CancellationToken ct)
+ private static async Task UploadCoreAsync(FileInfo file, Stream stream, CancellationToken ct)
{
try
{
diff --git a/src/Squidex.Infrastructure/Caching/AsyncLocalCache.cs b/src/Squidex.Infrastructure/Caching/AsyncLocalCache.cs
index e892a4019..e6222aa37 100644
--- a/src/Squidex.Infrastructure/Caching/AsyncLocalCache.cs
+++ b/src/Squidex.Infrastructure/Caching/AsyncLocalCache.cs
@@ -49,7 +49,7 @@ namespace Squidex.Infrastructure.Caching
if (cache != null)
{
- cache.TryRemove(cacheKey, out var value);
+ cache.TryRemove(cacheKey, out _);
}
}
diff --git a/src/Squidex.Infrastructure/Commands/DomainObjectGrain.cs b/src/Squidex.Infrastructure/Commands/DomainObjectGrain.cs
index 10f3c2d01..04b05efd3 100644
--- a/src/Squidex.Infrastructure/Commands/DomainObjectGrain.cs
+++ b/src/Squidex.Infrastructure/Commands/DomainObjectGrain.cs
@@ -36,8 +36,6 @@ namespace Squidex.Infrastructure.Commands
{
var newVersion = Version + 1;
- var snapshotNew = OnEvent(@event);
-
snapshot = OnEvent(@event);
snapshot.Version = newVersion;
}
diff --git a/src/Squidex.Infrastructure/Commands/GrainCommandMiddleware.cs b/src/Squidex.Infrastructure/Commands/GrainCommandMiddleware.cs
index 97ebe0b0d..2811548ab 100644
--- a/src/Squidex.Infrastructure/Commands/GrainCommandMiddleware.cs
+++ b/src/Squidex.Infrastructure/Commands/GrainCommandMiddleware.cs
@@ -22,7 +22,7 @@ namespace Squidex.Infrastructure.Commands
this.grainFactory = grainFactory;
}
- public async virtual Task HandleAsync(CommandContext context, Func next)
+ public virtual async Task HandleAsync(CommandContext context, Func next)
{
if (context.Command is TCommand typedCommand)
{
diff --git a/src/Squidex.Infrastructure/EventSourcing/Grains/WrapperSubscription.cs b/src/Squidex.Infrastructure/EventSourcing/Grains/WrapperSubscription.cs
index 012179f1f..6862a1504 100644
--- a/src/Squidex.Infrastructure/EventSourcing/Grains/WrapperSubscription.cs
+++ b/src/Squidex.Infrastructure/EventSourcing/Grains/WrapperSubscription.cs
@@ -36,7 +36,7 @@ namespace Squidex.Infrastructure.EventSourcing.Grains
private Task Dispatch(Func task)
{
- return Task.Factory.StartNew(() => task(), CancellationToken.None, TaskCreationOptions.None, scheduler).Unwrap();
+ return Task.Factory.StartNew(task, CancellationToken.None, TaskCreationOptions.None, scheduler).Unwrap();
}
}
}
diff --git a/src/Squidex.Infrastructure/EventSourcing/PollingSubscription.cs b/src/Squidex.Infrastructure/EventSourcing/PollingSubscription.cs
index 10c908ad5..59b8047cb 100644
--- a/src/Squidex.Infrastructure/EventSourcing/PollingSubscription.cs
+++ b/src/Squidex.Infrastructure/EventSourcing/PollingSubscription.cs
@@ -6,7 +6,6 @@
// ==========================================================================
using System;
-using System.Text.RegularExpressions;
using System.Threading.Tasks;
using Squidex.Infrastructure.Timers;
@@ -14,12 +13,7 @@ namespace Squidex.Infrastructure.EventSourcing
{
public sealed class PollingSubscription : IEventSubscription
{
- private readonly IEventStore eventStore;
- private readonly IEventSubscriber eventSubscriber;
private readonly CompletionTimer timer;
- private readonly Regex streamRegex;
- private readonly string streamFilter;
- private string position;
public PollingSubscription(
IEventStore eventStore,
@@ -30,13 +24,6 @@ namespace Squidex.Infrastructure.EventSourcing
Guard.NotNull(eventStore, nameof(eventStore));
Guard.NotNull(eventSubscriber, nameof(eventSubscriber));
- this.position = position;
- this.eventStore = eventStore;
- this.eventSubscriber = eventSubscriber;
- this.streamFilter = streamFilter;
-
- streamRegex = new Regex(streamFilter);
-
timer = new CompletionTimer(5000, async ct =>
{
try
diff --git a/src/Squidex.Infrastructure/FileExtensions.cs b/src/Squidex.Infrastructure/FileExtensions.cs
index bc54d13fb..885a47a9a 100644
--- a/src/Squidex.Infrastructure/FileExtensions.cs
+++ b/src/Squidex.Infrastructure/FileExtensions.cs
@@ -23,7 +23,7 @@ namespace Squidex.Infrastructure
"TB"
};
- private static readonly Dictionary UnifiedExtensions = new Dictionary()
+ private static readonly Dictionary UnifiedExtensions = new Dictionary
{
["jpeg"] = "jpg"
};
diff --git a/src/Squidex.Infrastructure/IResultList.cs b/src/Squidex.Infrastructure/IResultList.cs
index 25687277d..69fee96c4 100644
--- a/src/Squidex.Infrastructure/IResultList.cs
+++ b/src/Squidex.Infrastructure/IResultList.cs
@@ -9,7 +9,7 @@ using System.Collections.Generic;
namespace Squidex.Infrastructure
{
- public interface IResultList : IReadOnlyList
+ public interface IResultList : IReadOnlyList
{
long Total { get; }
}
diff --git a/src/Squidex.Infrastructure/Queries/FilterValueType.cs b/src/Squidex.Infrastructure/Queries/FilterValueType.cs
index 95c13afa4..7693058db 100644
--- a/src/Squidex.Infrastructure/Queries/FilterValueType.cs
+++ b/src/Squidex.Infrastructure/Queries/FilterValueType.cs
@@ -16,6 +16,6 @@ namespace Squidex.Infrastructure.Queries
Int32,
Int64,
Single,
- String,
+ String
}
}
diff --git a/src/Squidex.Infrastructure/Queries/OData/ConstantWithTypeVisitor.cs b/src/Squidex.Infrastructure/Queries/OData/ConstantWithTypeVisitor.cs
index 54b6f6264..50d86cd37 100644
--- a/src/Squidex.Infrastructure/Queries/OData/ConstantWithTypeVisitor.cs
+++ b/src/Squidex.Infrastructure/Queries/OData/ConstantWithTypeVisitor.cs
@@ -87,6 +87,11 @@ namespace Squidex.Infrastructure.Queries.OData
return (nodeIn.Value, FilterValueType.Boolean);
}
+ if (nodeIn.TypeReference.Definition == SingleType)
+ {
+ return (nodeIn.Value, FilterValueType.Single);
+ }
+
if (nodeIn.TypeReference.Definition == DoubleType)
{
return (nodeIn.Value, FilterValueType.Double);
diff --git a/src/Squidex.Infrastructure/Queries/OData/FilterVisitor.cs b/src/Squidex.Infrastructure/Queries/OData/FilterVisitor.cs
index 7b4cbae29..98764981a 100644
--- a/src/Squidex.Infrastructure/Queries/OData/FilterVisitor.cs
+++ b/src/Squidex.Infrastructure/Queries/OData/FilterVisitor.cs
@@ -84,7 +84,7 @@ namespace Squidex.Infrastructure.Queries.OData
{
var regexFilter = Visit(functionNode);
- var (value, valueType) = ConstantWithTypeVisitor.Visit(nodeIn.Right);
+ var (value, _) = ConstantWithTypeVisitor.Visit(nodeIn.Right);
if (value is bool booleanRight)
{
diff --git a/src/Squidex.Infrastructure/States/IPersistence{TState}.cs b/src/Squidex.Infrastructure/States/IPersistence{TState}.cs
index c69e95926..a804dece1 100644
--- a/src/Squidex.Infrastructure/States/IPersistence{TState}.cs
+++ b/src/Squidex.Infrastructure/States/IPersistence{TState}.cs
@@ -11,13 +11,13 @@ using Squidex.Infrastructure.EventSourcing;
namespace Squidex.Infrastructure.States
{
- public interface IPersistence
+ public interface IPersistence
{
long Version { get; }
Task DeleteAsync();
- Task WriteEventsAsync(IEnumerable> @events);
+ Task WriteEventsAsync(IEnumerable> events);
Task WriteSnapshotAsync(TState state);
diff --git a/src/Squidex.Infrastructure/States/ISnapshotStore.cs b/src/Squidex.Infrastructure/States/ISnapshotStore.cs
index 9431226f1..38646e64f 100644
--- a/src/Squidex.Infrastructure/States/ISnapshotStore.cs
+++ b/src/Squidex.Infrastructure/States/ISnapshotStore.cs
@@ -10,7 +10,7 @@ using System.Threading.Tasks;
namespace Squidex.Infrastructure.States
{
- public interface ISnapshotStore
+ public interface ISnapshotStore
{
Task WriteAsync(TKey key, T value, long oldVersion, long newVersion);
diff --git a/src/Squidex.Infrastructure/States/IStore.cs b/src/Squidex.Infrastructure/States/IStore.cs
index 57b33552e..28c44fd78 100644
--- a/src/Squidex.Infrastructure/States/IStore.cs
+++ b/src/Squidex.Infrastructure/States/IStore.cs
@@ -11,7 +11,7 @@ using Squidex.Infrastructure.EventSourcing;
namespace Squidex.Infrastructure.States
{
- public interface IStore
+ public interface IStore
{
IPersistence WithEventSourcing(Type owner, TKey key, Func, Task> applyEvent);
diff --git a/src/Squidex.Infrastructure/States/Persistence{TSnapshot,TKey}.cs b/src/Squidex.Infrastructure/States/Persistence{TSnapshot,TKey}.cs
index 5c6a22c3f..d07e2d7a4 100644
--- a/src/Squidex.Infrastructure/States/Persistence{TSnapshot,TKey}.cs
+++ b/src/Squidex.Infrastructure/States/Persistence{TSnapshot,TKey}.cs
@@ -147,7 +147,7 @@ namespace Squidex.Infrastructure.States
public async Task WriteEventsAsync(IEnumerable> events)
{
- Guard.NotNull(events, nameof(@events));
+ Guard.NotNull(events, nameof(events));
var eventArray = events.ToArray();
@@ -162,7 +162,7 @@ namespace Squidex.Infrastructure.States
try
{
- await eventStore.AppendAsync(commitId, GetStreamName(), expectedVersion, eventData);
+ await eventStore.AppendAsync(commitId, eventStream, expectedVersion, eventData);
}
catch (WrongEventVersionException ex)
{
@@ -190,7 +190,7 @@ namespace Squidex.Infrastructure.States
private EventData[] GetEventData(Envelope[] events, Guid commitId)
{
- return @events.Select(x => eventDataFormatter.ToEventData(x, commitId, true)).ToArray();
+ return events.Select(x => eventDataFormatter.ToEventData(x, commitId, true)).ToArray();
}
private string GetStreamName()
diff --git a/src/Squidex.Infrastructure/StringExtensions.cs b/src/Squidex.Infrastructure/StringExtensions.cs
index d287948e2..55349977a 100644
--- a/src/Squidex.Infrastructure/StringExtensions.cs
+++ b/src/Squidex.Infrastructure/StringExtensions.cs
@@ -327,7 +327,7 @@ namespace Squidex.Infrastructure
{
var sb = new StringBuilder();
- foreach (var part in value.Split(new char[] { '-', '_', ' ' }, StringSplitOptions.RemoveEmptyEntries))
+ foreach (var part in value.Split(new[] { '-', '_', ' ' }, StringSplitOptions.RemoveEmptyEntries))
{
if (part.Length < 2)
{
@@ -347,7 +347,7 @@ namespace Squidex.Infrastructure
{
var sb = new StringBuilder();
- foreach (var part in value.Split(new char[] { '-', '_', ' ' }, StringSplitOptions.RemoveEmptyEntries))
+ foreach (var part in value.Split(new[] { '-', '_', ' ' }, StringSplitOptions.RemoveEmptyEntries))
{
if (sb.Length > 0)
{
diff --git a/src/Squidex.Infrastructure/ValidationException.cs b/src/Squidex.Infrastructure/ValidationException.cs
index 764e45ab7..3d5809a46 100644
--- a/src/Squidex.Infrastructure/ValidationException.cs
+++ b/src/Squidex.Infrastructure/ValidationException.cs
@@ -38,7 +38,7 @@ namespace Squidex.Infrastructure
}
public ValidationException(string summary, Exception inner, params ValidationError[] errors)
- : this(summary, null, errors?.ToList())
+ : this(summary, inner, errors?.ToList())
{
}
diff --git a/src/Squidex/Areas/Api/Controllers/Apps/Models/AppCreatedDto.cs b/src/Squidex/Areas/Api/Controllers/Apps/Models/AppCreatedDto.cs
index b346838d0..5bff6c58b 100644
--- a/src/Squidex/Areas/Api/Controllers/Apps/Models/AppCreatedDto.cs
+++ b/src/Squidex/Areas/Api/Controllers/Apps/Models/AppCreatedDto.cs
@@ -46,12 +46,14 @@ namespace Squidex.Areas.Api.Controllers.Apps.Models
public static AppCreatedDto FromResult(EntityCreatedResult result, IAppPlansProvider apps)
{
- var response = new AppCreatedDto { Id = result.IdOrValue.ToString(), Version = result.Version };
-
- response.Permission = AppContributorPermission.Owner;
-
- response.PlanName = apps.GetPlan(null)?.Name;
- response.PlanUpgrade = apps.GetPlanUpgrade(null)?.Name;
+ var response = new AppCreatedDto
+ {
+ Id = result.IdOrValue.ToString(),
+ Permission = AppContributorPermission.Owner,
+ PlanName = apps.GetPlan(null)?.Name,
+ PlanUpgrade = apps.GetPlanUpgrade(null)?.Name,
+ Version = result.Version
+ };
return response;
}
diff --git a/src/Squidex/Areas/Api/Controllers/Backups/RestoreController.cs b/src/Squidex/Areas/Api/Controllers/Backups/RestoreController.cs
index 2162860a5..18fa86278 100644
--- a/src/Squidex/Areas/Api/Controllers/Backups/RestoreController.cs
+++ b/src/Squidex/Areas/Api/Controllers/Backups/RestoreController.cs
@@ -49,8 +49,6 @@ namespace Squidex.Areas.Api.Controllers.Backups
return NotFound();
}
- var jobs = await restoreGrain.GetJobAsync();
-
var response = RestoreJobDto.FromJob(job.Value);
return Ok(response);
diff --git a/src/Squidex/Areas/Api/Controllers/JsonInheritanceConverter.cs b/src/Squidex/Areas/Api/Controllers/JsonInheritanceConverter.cs
index c3fce9a6e..b21fcef56 100644
--- a/src/Squidex/Areas/Api/Controllers/JsonInheritanceConverter.cs
+++ b/src/Squidex/Areas/Api/Controllers/JsonInheritanceConverter.cs
@@ -125,7 +125,7 @@ namespace Squidex.Areas.Api.Controllers
return null;
}
- if (subName == null || !mapTypeToName.TryGetValue(subName, out var subType))
+ if (!mapTypeToName.TryGetValue(subName, out var subType))
{
throw new InvalidOperationException($"Could not find subtype of '{objectType.Name}' with discriminator '{subName}'.");
}
diff --git a/src/Squidex/Areas/IdentityServer/Views/Account/Consent.cshtml b/src/Squidex/Areas/IdentityServer/Views/Account/Consent.cshtml
index 19c0bfb8b..e5875696e 100644
--- a/src/Squidex/Areas/IdentityServer/Views/Account/Consent.cshtml
+++ b/src/Squidex/Areas/IdentityServer/Views/Account/Consent.cshtml
@@ -28,7 +28,7 @@
- I understand and agree that Squidex sends e-mails to inform me about new features, breaking changes and downtimes.
+ I understand and agree that Squidex sends e-mails to inform me about new features, breaking changes and down times.