Browse Source

Smells removed.

pull/316/head
Sebastian Stehle 8 years ago
parent
commit
f228efb31c
  1. 1
      extensions/Squidex.Extensions/Actions/Discourse/DiscourseActionHandler.cs
  2. 3
      extensions/Squidex.Extensions/Actions/Fastly/FastlyActionHandler.cs
  3. 2
      extensions/Squidex.Extensions/Actions/HttpHelper.cs
  4. 1
      extensions/Squidex.Extensions/Actions/Medium/MediumActionHandler.cs
  5. 1
      extensions/Squidex.Extensions/Actions/Prerender/PrerenderActionHandler.cs
  6. 2
      extensions/Squidex.Extensions/Actions/RuleActionAttribute.cs
  7. 2
      extensions/Squidex.Extensions/Actions/RuleActionHandlerAttribute.cs
  8. 1
      extensions/Squidex.Extensions/Actions/Slack/SlackActionHandler.cs
  9. 2
      extensions/Squidex.Extensions/Actions/Twitter/TweetActionHandler.cs
  10. 2
      extensions/Squidex.Extensions/Actions/Webhook/WebhookAction.cs
  11. 1
      extensions/Squidex.Extensions/Actions/Webhook/WebhookActionHandler.cs
  12. 11
      src/Squidex.Domain.Apps.Core.Model/Apps/LanguagesConfig.cs
  13. 2
      src/Squidex.Domain.Apps.Core.Model/Rules/Json/JsonRule.cs
  14. 2
      src/Squidex.Domain.Apps.Core.Model/Schemas/IField{T}.cs
  15. 6
      src/Squidex.Domain.Apps.Core.Operations/ConvertContent/FieldConverters.cs
  16. 5
      src/Squidex.Domain.Apps.Core.Operations/ConvertContent/ValueConverters.cs
  17. 6
      src/Squidex.Domain.Apps.Core.Operations/ExtractReferenceIds/ReferencesExtractor.cs
  18. 4
      src/Squidex.Domain.Apps.Core.Operations/HandleRules/RuleActionHandler.cs
  19. 12
      src/Squidex.Domain.Apps.Core.Operations/HandleRules/RuleEventFormatter.cs
  20. 1
      src/Squidex.Domain.Apps.Core.Operations/HandleRules/RuleService.cs
  21. 8
      src/Squidex.Domain.Apps.Core.Operations/HandleRules/Triggers/AssetChangedTriggerHandler.cs
  22. 2
      src/Squidex.Domain.Apps.Core.Operations/HandleRules/Triggers/ContentChangedTriggerHandler.cs
  23. 4
      src/Squidex.Domain.Apps.Core.Operations/Tags/TagNormalizer.cs
  24. 2
      src/Squidex.Domain.Apps.Core.Operations/ValidateContent/Validators/FieldValidator.cs
  25. 2
      src/Squidex.Domain.Apps.Core.Operations/ValidateContent/Validators/RequiredStringValidator.cs
  26. 1
      src/Squidex.Domain.Apps.Entities.MongoDb/Assets/MongoAssetEntity.cs
  27. 2
      src/Squidex.Domain.Apps.Entities.MongoDb/Assets/MongoAssetRepository.cs
  28. 3
      src/Squidex.Domain.Apps.Entities.MongoDb/Contents/Extensions.cs
  29. 2
      src/Squidex.Domain.Apps.Entities.MongoDb/Contents/MongoContentDraftCollection.cs
  30. 2
      src/Squidex.Domain.Apps.Entities.MongoDb/Contents/Visitors/FindExtensions.cs
  31. 2
      src/Squidex.Domain.Apps.Entities/Apps/BackupApps.cs
  32. 3
      src/Squidex.Domain.Apps.Entities/Apps/Commands/CreateApp.cs
  33. 2
      src/Squidex.Domain.Apps.Entities/Apps/Guards/GuardAppClients.cs
  34. 2
      src/Squidex.Domain.Apps.Entities/Apps/Indexes/AppsByNameIndexCommandMiddleware.cs
  35. 8
      src/Squidex.Domain.Apps.Entities/Apps/Templates/CreateBlogCommandMiddleware.cs
  36. 12
      src/Squidex.Domain.Apps.Entities/Apps/Templates/CreateIdentityCommandMiddleware.cs
  37. 14
      src/Squidex.Domain.Apps.Entities/Apps/Templates/CreateProfileCommandMiddleware.cs
  38. 2
      src/Squidex.Domain.Apps.Entities/Assets/AssetCommandMiddleware.cs
  39. 4
      src/Squidex.Domain.Apps.Entities/Assets/AssetQueryService.cs
  40. 2
      src/Squidex.Domain.Apps.Entities/Assets/State/AssetState.cs
  41. 2
      src/Squidex.Domain.Apps.Entities/Backup/BackupReader.cs
  42. 2
      src/Squidex.Domain.Apps.Entities/Backup/BackupWriter.cs
  43. 2
      src/Squidex.Domain.Apps.Entities/Backup/Helpers/ArchiveHelper.cs
  44. 19
      src/Squidex.Domain.Apps.Entities/Backup/RestoreGrain.cs
  45. 2
      src/Squidex.Domain.Apps.Entities/Backup/TempFolderBackupArchiveLocation.cs
  46. 7
      src/Squidex.Domain.Apps.Entities/Contents/BackupContents.cs
  47. 6
      src/Squidex.Domain.Apps.Entities/Contents/ContentGrain.cs
  48. 12
      src/Squidex.Domain.Apps.Entities/Contents/ContentOperationContext.cs
  49. 6
      src/Squidex.Domain.Apps.Entities/Contents/ContentQueryService.cs
  50. 2
      src/Squidex.Domain.Apps.Entities/Contents/ContentSchedulerGrain.cs
  51. 10
      src/Squidex.Domain.Apps.Entities/Contents/GraphQL/GraphQLModel.cs
  52. 6
      src/Squidex.Domain.Apps.Entities/Contents/GraphQL/Types/AssetsResultGraphType.cs
  53. 1
      src/Squidex.Domain.Apps.Entities/Contents/GraphQL/Types/NestedGraphType.cs
  54. 2
      src/Squidex.Domain.Apps.Entities/Contents/GraphQL/Types/QueryGraphTypeVisitor.cs
  55. 5
      src/Squidex.Domain.Apps.Entities/Rules/BackupRules.cs
  56. 2
      src/Squidex.Domain.Apps.Entities/Rules/RuleDequeuerGrain.cs
  57. 2
      src/Squidex.Domain.Apps.Entities/Schemas/BackupSchemas.cs
  58. 2
      src/Squidex.Domain.Apps.Entities/Schemas/Commands/SchemaCommand.cs
  59. 4
      src/Squidex.Domain.Apps.Entities/Schemas/Guards/GuardSchemaField.cs
  60. 2
      src/Squidex.Domain.Apps.Entities/Schemas/SchemaGrain.cs
  61. 2
      src/Squidex.Domain.Apps.Entities/Schemas/State/SchemaState.cs
  62. 2
      src/Squidex.Domain.Apps.Entities/Tags/ITagGenerator.cs
  63. 2
      src/Squidex.Domain.Users.MongoDb/MongoUserStore.cs
  64. 4
      src/Squidex.Infrastructure.Azure/Assets/AzureBlobAssetStore.cs
  65. 25
      src/Squidex.Infrastructure.GetEventStore/EventSourcing/GetEventStore.cs
  66. 1
      src/Squidex.Infrastructure.GetEventStore/EventSourcing/GetEventStoreSubscription.cs
  67. 2
      src/Squidex.Infrastructure.MongoDb/Assets/MongoGridFsAssetStore.cs
  68. 1
      src/Squidex.Infrastructure.MongoDb/EventSourcing/MongoEventStore_Writer.cs
  69. 6
      src/Squidex.Infrastructure.MongoDb/MongoDb/BsonJsonConverter.cs
  70. 4
      src/Squidex.Infrastructure.MongoDb/MongoDb/OData/FilterVisitor.cs
  71. 10
      src/Squidex.Infrastructure.MongoDb/States/MongoSnapshotStore.cs
  72. 3
      src/Squidex.Infrastructure.RabbitMq/CQRS/Events/RabbitMqEventConsumer.cs
  73. 2
      src/Squidex.Infrastructure/Assets/FolderAssetStore.cs
  74. 2
      src/Squidex.Infrastructure/Caching/AsyncLocalCache.cs
  75. 2
      src/Squidex.Infrastructure/Commands/DomainObjectGrain.cs
  76. 2
      src/Squidex.Infrastructure/Commands/GrainCommandMiddleware.cs
  77. 2
      src/Squidex.Infrastructure/EventSourcing/Grains/WrapperSubscription.cs
  78. 13
      src/Squidex.Infrastructure/EventSourcing/PollingSubscription.cs
  79. 2
      src/Squidex.Infrastructure/FileExtensions.cs
  80. 2
      src/Squidex.Infrastructure/IResultList.cs
  81. 2
      src/Squidex.Infrastructure/Queries/FilterValueType.cs
  82. 5
      src/Squidex.Infrastructure/Queries/OData/ConstantWithTypeVisitor.cs
  83. 2
      src/Squidex.Infrastructure/Queries/OData/FilterVisitor.cs
  84. 4
      src/Squidex.Infrastructure/States/IPersistence{TState}.cs
  85. 2
      src/Squidex.Infrastructure/States/ISnapshotStore.cs
  86. 2
      src/Squidex.Infrastructure/States/IStore.cs
  87. 6
      src/Squidex.Infrastructure/States/Persistence{TSnapshot,TKey}.cs
  88. 4
      src/Squidex.Infrastructure/StringExtensions.cs
  89. 2
      src/Squidex.Infrastructure/ValidationException.cs
  90. 14
      src/Squidex/Areas/Api/Controllers/Apps/Models/AppCreatedDto.cs
  91. 2
      src/Squidex/Areas/Api/Controllers/Backups/RestoreController.cs
  92. 2
      src/Squidex/Areas/Api/Controllers/JsonInheritanceConverter.cs
  93. 2
      src/Squidex/Areas/IdentityServer/Views/Account/Consent.cshtml
  94. 6
      src/Squidex/Areas/IdentityServer/Views/Account/Login.cshtml
  95. 2
      src/Squidex/Areas/IdentityServer/Views/Profile/Profile.cshtml
  96. 1
      src/Squidex/Config/Domain/EventPublishersServices.cs
  97. 5
      src/Squidex/Config/ServiceExtensions.cs
  98. 2
      src/Squidex/Pipeline/CommandMiddlewares/EnrichWithSchemaIdCommandMiddleware.cs
  99. 1
      src/Squidex/Pipeline/RequestLogPerformanceMiddleware.cs
  100. 2
      src/Squidex/Program.cs

1
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

3
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);
}
}
}

2
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
{

1
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;

1
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

2
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; }

2
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; }

1
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;

2
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);
}

2
extensions/Squidex.Extensions/Actions/WebhookAction/WebhookAction.cs → extensions/Squidex.Extensions/Actions/Webhook/WebhookAction.cs

@ -16,7 +16,7 @@ namespace Squidex.Extensions.Actions.Webhook
[RuleAction(
IconImage = "<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 28 28'><path d='M5.95 27.125h-.262C1.75 26.425 0 23.187 0 20.3c0-2.713 1.575-5.688 5.075-6.563V9.712c0-.525.35-.875.875-.875s.875.35.875.875v4.725c0 .438-.35.787-.7.875-2.975.438-4.375 2.8-4.375 4.988s1.313 4.55 4.2 5.075h.175a.907.907 0 0 1 .7 1.05c-.088.438-.438.7-.875.7zM21.175 27.387c-2.8 0-5.775-1.662-6.65-5.075H9.712c-.525 0-.875-.35-.875-.875s.35-.875.875-.875h5.512c.438 0 .787.35.875.7.438 2.975 2.8 4.288 4.988 4.375 2.188 0 4.55-1.313 5.075-4.2v-.088a.908.908 0 0 1 1.05-.7.908.908 0 0 1 .7 1.05v.088c-.612 3.85-3.85 5.6-6.737 5.6zM21.525 18.55c-.525 0-.875-.35-.875-.875v-4.813c0-.438.35-.787.7-.875 2.975-.438 4.288-2.8 4.375-4.987 0-2.188-1.313-4.55-4.2-5.075h-.088c-.525-.175-.875-.613-.787-1.05s.525-.788 1.05-.7h.088c3.938.7 5.688 3.937 5.688 6.825 0 2.713-1.662 5.688-5.075 6.563v4.113c0 .438-.438.875-.875.875zM1.137 6.737H.962c-.438-.087-.788-.525-.7-.963v-.087c.7-3.938 3.85-5.688 6.737-5.688h.087c2.712 0 5.688 1.662 6.563 5.075h4.025c.525 0 .875.35.875.875s-.35.875-.875.875h-4.725c-.438 0-.788-.35-.875-.7-.438-2.975-2.8-4.288-4.988-4.375-2.188 0-4.55 1.313-5.075 4.2v.087c-.088.438-.438.7-.875.7z'/><path d='M7 10.588c-.875 0-1.837-.35-2.538-1.05a3.591 3.591 0 0 1 0-5.075C5.162 3.851 6.037 3.5 7 3.5s1.838.35 2.537 1.05c.7.7 1.05 1.575 1.05 2.537s-.35 1.837-1.05 2.538c-.7.612-1.575.963-2.537.963zM7 5.25c-.438 0-.875.175-1.225.525a1.795 1.795 0 0 0 2.538 2.538c.35-.35.525-.788.525-1.313s-.175-.875-.525-1.225S7.525 5.25 7 5.25zM21.088 23.887a3.65 3.65 0 0 1-2.537-1.05 3.591 3.591 0 0 1 0-5.075c.7-.7 1.575-1.05 2.537-1.05s1.838.35 2.537 1.05c.7.7 1.05 1.575 1.05 2.538s-.35 1.837-1.05 2.537c-.787.7-1.662 1.05-2.537 1.05zm0-5.337c-.525 0-.963.175-1.313.525a1.795 1.795 0 0 0 2.537 2.538c.35-.35.525-.788.525-1.313s-.175-.963-.525-1.313-.787-.438-1.225-.438zM20.387 10.588c-.875 0-1.837-.35-2.537-1.05S16.8 7.963 16.8 7.001s.35-1.837 1.05-2.538c.7-.612 1.662-.962 2.537-.962s1.838.35 2.538 1.05c1.4 1.4 1.4 3.675 0 5.075-.7.612-1.575.963-2.538.963zm0-5.338c-.525 0-.962.175-1.313.525s-.525.788-.525 1.313.175.962.525 1.313c.7.7 1.838.7 2.538 0s.7-1.838 0-2.538c-.263-.438-.7-.612-1.225-.612zM7.087 23.887c-.875 0-1.837-.35-2.538-1.05s-1.05-1.575-1.05-2.537.35-1.838 1.05-2.538c.7-.612 1.575-.962 2.538-.962s1.837.35 2.538 1.05c1.4 1.4 1.4 3.675 0 5.075-.7.612-1.575.962-2.538.962zm0-5.337c-.525 0-.962.175-1.313.525s-.525.788-.525 1.313.175.963.525 1.313a1.794 1.794 0 1 0 2.538-2.537c-.263-.438-.7-.612-1.225-.612z'/></svg>",
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

1
extensions/Squidex.Extensions/Actions/WebhookAction/WebhookActionHandler.cs → 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;

11
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 =

2
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;

2
src/Squidex.Domain.Apps.Core.Model/Schemas/IField{T}.cs

@ -7,7 +7,7 @@
namespace Squidex.Domain.Apps.Core.Schemas
{
public interface IField<T> : IField
public interface IField<out T> : IField
{
T Properties { get; }
}

6
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) =>
{

5
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()

6
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)));
}
}
}

4
src/Squidex.Domain.Apps.Core.Operations/HandleRules/RuleActionHandler.cs

@ -34,7 +34,7 @@ namespace Squidex.Domain.Apps.Core.HandleRules
protected virtual string ToPayloadJson<T>(T @event)
{
return formatter.ToPayload<T>(@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>(T @event)
{
return formatter.ToPayload<T>(@event);
return formatter.ToPayload(@event);
}
protected virtual JObject ToEnvelope(EnrichedEvent @event)

12
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;
}
}
}

1
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<Type, IRuleActionHandler> ruleActionHandlers;
private readonly Dictionary<Type, IRuleTriggerHandler> ruleTriggerHandlers;
private readonly TypeNameRegistry typeNameRegistry;

8
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;
}
}
}

2
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;
}
}
}

4
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<string> values, List<JArray> arrays)
private static void ExtractTags(JToken token, ISet<string> values, ICollection<JArray> arrays)
{
if (token is JArray jArray)
{

2
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<Task>();
foreach (var validator in ValidatorsFactory.CreateValidators(field))
foreach (var validator in validators)
{
tasks.Add(validator.ValidateAsync(typedValue, context, addError));
}

2
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.");
}

1
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;

2
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 =

3
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)
{

2
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);
}

2
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;
});

2
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<IEvent> @event, Guid appId, BackupReader reader, RefToken actor)
public override async Task RestoreEventAsync(Envelope<IEvent> @event, Guid appId, BackupReader reader, RefToken actor)
{
switch (@event.Payload)
{

3
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; }

2
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.");
}
});
}

2
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);
}

8
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<ICommand, Task> publish)
private static async Task CreatePostsAsync(Func<ICommand, Task> publish)
{
var postsId = await CreatePostsSchemaAsync(publish);
@ -83,7 +83,7 @@ namespace Squidex.Domain.Apps.Entities.Apps.Templates
});
}
private async Task CreatePagesAsync(Func<ICommand, Task> publish)
private static async Task CreatePagesAsync(Func<ICommand, Task> publish)
{
var pagesId = await CreatePagesSchemaAsync(publish);
@ -102,7 +102,7 @@ namespace Squidex.Domain.Apps.Entities.Apps.Templates
});
}
private async Task<NamedId<Guid>> CreatePostsSchemaAsync(Func<ICommand, Task> publish)
private static async Task<NamedId<Guid>> CreatePostsSchemaAsync(Func<ICommand, Task> publish)
{
var schema =
SchemaBuilder.Create("Posts")
@ -136,7 +136,7 @@ namespace Squidex.Domain.Apps.Entities.Apps.Templates
return schemaId;
}
private async Task<NamedId<Guid>> CreatePagesSchemaAsync(Func<ICommand, Task> publish)
private static async Task<NamedId<Guid>> CreatePagesSchemaAsync(Func<ICommand, Task> publish)
{
var schema =
SchemaBuilder.Create("Pages")

12
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<NamedId<Guid>> CreateAuthenticationSchemeSchemaAsync(Func<ICommand, Task> publish)
private static async Task<NamedId<Guid>> CreateAuthenticationSchemeSchemaAsync(Func<ICommand, Task> 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<ICommand, Task> publish)
private static Task CreateClientsSchemaAsync(Func<ICommand, Task> publish)
{
var schema =
SchemaBuilder.Create("Clients")
@ -134,7 +134,7 @@ namespace Squidex.Domain.Apps.Entities.Apps.Templates
return publish(schema);
}
private Task CreateSettingsSchemaAsync(Func<ICommand, Task> publish)
private static Task CreateSettingsSchemaAsync(Func<ICommand, Task> 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<ICommand, Task> publish)
private static async Task CreateUsersSchemaAsync(Func<ICommand, Task> publish)
{
var schema =
SchemaBuilder.Create("Users")
@ -261,7 +261,7 @@ namespace Squidex.Domain.Apps.Entities.Apps.Templates
});
}
private Task CreateApiResourcesSchemaAsync(Func<ICommand, Task> publish)
private static Task CreateApiResourcesSchemaAsync(Func<ICommand, Task> 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<ICommand, Task> publish)
private static Task CreateIdentityResourcesSchemaAsync(Func<ICommand, Task> publish)
{
var schema =
SchemaBuilder.Create("Identity Resources")

14
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<ICommand, Task> publish)
private static async Task CreateBasicsAsync(Func<ICommand, Task> publish)
{
var postsId = await CreateBasicsSchemaAsync(publish);
@ -81,7 +81,7 @@ namespace Squidex.Domain.Apps.Entities.Apps.Templates
});
}
private async Task<NamedId<Guid>> CreateBasicsSchemaAsync(Func<ICommand, Task> publish)
private static async Task<NamedId<Guid>> CreateBasicsSchemaAsync(Func<ICommand, Task> 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<NamedId<Guid>> CreateProjectsSchemaAsync(Func<ICommand, Task> publish)
private static async Task<NamedId<Guid>> CreateProjectsSchemaAsync(Func<ICommand, Task> 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<NamedId<Guid>> CreateExperienceSchemaAsync(Func<ICommand, Task> publish)
private static async Task<NamedId<Guid>> CreateExperienceSchemaAsync(Func<ICommand, Task> 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<NamedId<Guid>> CreateEducationSchemaAsync(Func<ICommand, Task> publish)
private static async Task<NamedId<Guid>> CreateEducationSchemaAsync(Func<ICommand, Task> 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<NamedId<Guid>> CreatePublicationsSchemaAsync(Func<ICommand, Task> publish)
private static async Task<NamedId<Guid>> CreatePublicationsSchemaAsync(Func<ICommand, Task> 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<NamedId<Guid>> CreateSkillsSchemaAsync(Func<ICommand, Task> publish)
private static async Task<NamedId<Guid>> CreateSkillsSchemaAsync(Func<ICommand, Task> publish)
{
var command =
SchemaBuilder.Create("Skills")

2
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<Task> next)
public override async Task HandleAsync(CommandContext context, Func<Task> next)
{
switch (context.Command)
{

4
src/Squidex.Domain.Apps.Entities/Assets/AssetQueryService.cs

@ -74,7 +74,7 @@ namespace Squidex.Domain.Apps.Entities.Assets
return assets;
}
private IResultList<IAssetEntity> Sort(IResultList<IAssetEntity> assets, IReadOnlyList<Guid> ids)
private static IResultList<IAssetEntity> Sort(IResultList<IAssetEntity> assets, IReadOnlyList<Guid> 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)
{

2
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<AssetState>, IAssetEntity, IAssetInfo
public class AssetState : DomainObjectState<AssetState>, IAssetEntity
{
[JsonProperty]
public NamedId<Guid> AppId { get; set; }

2
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;

2
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;

2
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
{

19
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<BackupHandler> handlers;
private readonly IEventStore eventStore;
private readonly IEventDataFormatter eventDataFormatter;
private readonly IGrainFactory grainFactory;
private readonly ISemanticLog log;
private readonly IStreamNameResolver streamNameResolver;
private readonly IStore<string> 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<BackupHandler> handlers,
ISemanticLog log,
IStreamNameResolver streamNameResolver,
IStore<string> 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);

2
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");
}
}
}

7
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<Guid> contentIds = new HashSet<Guid>();
private readonly IContentRepository contentRepository;
public override string Name { get; } = "Contents";
public BackupContents(IStore<Guid> store, IContentRepository contentRepository)
public BackupContents(IStore<Guid> store)
: base(store)
{
Guard.NotNull(contentRepository, nameof(contentRepository));
this.contentRepository = contentRepository;
}
public override Task RestoreEventAsync(Envelope<IEvent> @event, Guid appId, BackupReader reader, RefToken actor)

6
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)
{

12
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<IReadOnlyList<IAssetInfo>> QueryAssetsAsync(IEnumerable<Guid> assetIds)

6
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<IContentEntity> Sort(IResultList<IContentEntity> contents, IReadOnlyList<Guid> ids)
private static IResultList<IContentEntity> Sort(IResultList<IContentEntity> contents, IReadOnlyList<Guid> 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<FieldConverter> GenerateConverters(QueryContext context, bool checkType)
private static IEnumerable<FieldConverter> 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)
{

2
src/Squidex.Domain.Apps.Entities/Contents/ContentSchedulerGrain.cs

@ -99,7 +99,7 @@ namespace Squidex.Domain.Apps.Entities.Contents
private Task Dispatch(Func<Task> task)
{
return Task<Task>.Factory.StartNew(() => task(), CancellationToken.None, TaskCreationOptions.None, scheduler ?? TaskScheduler.Default).Unwrap();
return Task<Task>.Factory.StartNew(task, CancellationToken.None, TaskCreationOptions.None, scheduler ?? TaskScheduler.Default).Unwrap();
}
}
}

10
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<ISchemaEntity> 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<IReadOnlyDictionary<string, JToken>, object>(c => c.Source.GetOrDefault(c.FieldName)));
}
public IFieldResolver ResolveAssetUrl()
{
var resolver = new FuncFieldResolver<IAssetEntity, object>(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)

6
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.";

1
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";

2
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<Guid, IGraphType> schemaResolver;
private readonly IGraphModel model;

5
src/Squidex.Domain.Apps.Entities/Rules/BackupRules.cs

@ -25,7 +25,6 @@ namespace Squidex.Domain.Apps.Entities.Rules
{
private readonly HashSet<Guid> ruleIds = new HashSet<Guid>();
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<IEvent> @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<RuleState, RuleGrain>(id, (e, s) => s.Apply(e)));

2
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 _);
}
}

2
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<SchemaState, SchemaGrain>(id, (e, s) => s.Apply(e, fieldRegistry)));

2
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
{

4
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.");
}
}
});

2
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)
{

2
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; }

2
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<T>
public interface ITagGenerator<in T>
{
void GenerateTags(T source, HashSet<string> tags);
}

2
src/Squidex.Domain.Users.MongoDb/MongoUserStore.cs

@ -390,7 +390,7 @@ namespace Squidex.Domain.Users.MongoDb
public async Task<IUser> FindByIdOrEmailAsync(string id)
{
if (ObjectId.TryParse(id, out var parsed))
if (ObjectId.TryParse(id, out _))
{
return await Collection.Find(x => x.Id == id).FirstOrDefaultAsync();
}

4
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);
}

25
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<StoredEvent, Task> callback, string streamName, long sliceStart, CancellationToken ct)
private async Task QueryAsync(Func<StoredEvent, Task> 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<IReadOnlyList<StoredEvent>> QueryAsync(string streamName, long streamPosition = 0)

1
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)
{

2
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)

1
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;

6
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;

4
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<T> Visit(FilterComparison nodeIn)
@ -75,7 +73,7 @@ namespace Squidex.Infrastructure.MongoDb.OData
throw new NotSupportedException();
}
private BsonRegularExpression BuildRegex(FilterComparison node, Func<string, string> formatter)
private static BsonRegularExpression BuildRegex(FilterComparison node, Func<string, string> formatter)
{
return new BsonRegularExpression(formatter(node.Value.ToString()), "i");
}

10
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<T, TKey> : MongoRepositoryBase<MongoState<T, TKey>>, ISnapshotStore<T, TKey>, IInitializable
public class MongoSnapshotStore<T, TKey> : MongoRepositoryBase<MongoState<T, TKey>>, ISnapshotStore<T, TKey>
{
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()

3
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
{

2
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
{

2
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 _);
}
}

2
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;
}

2
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<Task> next)
public virtual async Task HandleAsync(CommandContext context, Func<Task> next)
{
if (context.Command is TCommand typedCommand)
{

2
src/Squidex.Infrastructure/EventSourcing/Grains/WrapperSubscription.cs

@ -36,7 +36,7 @@ namespace Squidex.Infrastructure.EventSourcing.Grains
private Task Dispatch(Func<Task> task)
{
return Task<Task>.Factory.StartNew(() => task(), CancellationToken.None, TaskCreationOptions.None, scheduler).Unwrap();
return Task<Task>.Factory.StartNew(task, CancellationToken.None, TaskCreationOptions.None, scheduler).Unwrap();
}
}
}

13
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

2
src/Squidex.Infrastructure/FileExtensions.cs

@ -23,7 +23,7 @@ namespace Squidex.Infrastructure
"TB"
};
private static readonly Dictionary<string, string> UnifiedExtensions = new Dictionary<string, string>()
private static readonly Dictionary<string, string> UnifiedExtensions = new Dictionary<string, string>
{
["jpeg"] = "jpg"
};

2
src/Squidex.Infrastructure/IResultList.cs

@ -9,7 +9,7 @@ using System.Collections.Generic;
namespace Squidex.Infrastructure
{
public interface IResultList<T> : IReadOnlyList<T>
public interface IResultList<out T> : IReadOnlyList<T>
{
long Total { get; }
}

2
src/Squidex.Infrastructure/Queries/FilterValueType.cs

@ -16,6 +16,6 @@ namespace Squidex.Infrastructure.Queries
Int32,
Int64,
Single,
String,
String
}
}

5
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);

2
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)
{

4
src/Squidex.Infrastructure/States/IPersistence{TState}.cs

@ -11,13 +11,13 @@ using Squidex.Infrastructure.EventSourcing;
namespace Squidex.Infrastructure.States
{
public interface IPersistence<TState>
public interface IPersistence<in TState>
{
long Version { get; }
Task DeleteAsync();
Task WriteEventsAsync(IEnumerable<Envelope<IEvent>> @events);
Task WriteEventsAsync(IEnumerable<Envelope<IEvent>> events);
Task WriteSnapshotAsync(TState state);

2
src/Squidex.Infrastructure/States/ISnapshotStore.cs

@ -10,7 +10,7 @@ using System.Threading.Tasks;
namespace Squidex.Infrastructure.States
{
public interface ISnapshotStore<T, TKey>
public interface ISnapshotStore<T, in TKey>
{
Task WriteAsync(TKey key, T value, long oldVersion, long newVersion);

2
src/Squidex.Infrastructure/States/IStore.cs

@ -11,7 +11,7 @@ using Squidex.Infrastructure.EventSourcing;
namespace Squidex.Infrastructure.States
{
public interface IStore<TKey>
public interface IStore<in TKey>
{
IPersistence WithEventSourcing(Type owner, TKey key, Func<Envelope<IEvent>, Task> applyEvent);

6
src/Squidex.Infrastructure/States/Persistence{TSnapshot,TKey}.cs

@ -147,7 +147,7 @@ namespace Squidex.Infrastructure.States
public async Task WriteEventsAsync(IEnumerable<Envelope<IEvent>> 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<IEvent>[] 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()

4
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)
{

2
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())
{
}

14
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<Guid> 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;
}

2
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);

2
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}'.");
}

2
src/Squidex/Areas/IdentityServer/Views/Account/Consent.cshtml

@ -28,7 +28,7 @@
<input type="checkbox" id="consentToAutomatedEmails" name="consentToAutomatedEmails" value="True" />
</div>
<div class="col">
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.
</div>
</div>
</div>

6
src/Squidex/Areas/IdentityServer/Views/Account/Login.cshtml

@ -53,11 +53,11 @@
</div>
}
@if (@Model.HasPasswordAuth)
@if (Model.HasPasswordAuth)
{
@if (Model.IsLogin)
if (Model.IsLogin)
{
@if (Model.IsFailed)
if (Model.IsFailed)
{
<div class="form-alert form-alert-error">Email or password not correct.</div>
}

2
src/Squidex/Areas/IdentityServer/Views/Profile/Profile.cshtml

@ -117,7 +117,7 @@
</table>
<form asp-controller="Profile" asp-action="AddLogin" method="post">
@foreach (var provider in Model.ExternalProviders.Where(x => !Model.ExternalLogins.Any(y => x.AuthenticationScheme == y.LoginProvider)))
@foreach (var provider in Model.ExternalProviders.Where(x => Model.ExternalLogins.All(y => x.AuthenticationScheme != y.LoginProvider)))
{
var schema = provider.AuthenticationScheme.ToLowerInvariant();

1
src/Squidex/Config/Domain/EventPublishersServices.cs

@ -10,6 +10,7 @@ using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Newtonsoft.Json;
using Squidex.Infrastructure;
using Squidex.Infrastructure.CQRS.Events;
using Squidex.Infrastructure.EventSourcing;
namespace Squidex.Config.Domain

5
src/Squidex/Config/ServiceExtensions.cs

@ -33,10 +33,7 @@ namespace Squidex.Config
{
if (typeof(TInterface) != typeof(T))
{
services.AddSingleton(typeof(TInterface), c =>
{
return c.GetRequiredService<T>();
});
services.AddSingleton(typeof(TInterface), c => c.GetRequiredService<T>());
}
return this;

2
src/Squidex/Pipeline/CommandMiddlewares/EnrichWithSchemaIdCommandMiddleware.cs

@ -66,7 +66,7 @@ namespace Squidex.Pipeline.CommandMiddlewares
{
var appFeature = actionContextAccessor.ActionContext.HttpContext.Features.Get<IAppFeature>();
if (appFeature != null && appFeature.App != null)
if (appFeature?.App != null)
{
appId = NamedId.Of(appFeature.App.Id, appFeature.App.Name);
}

1
src/Squidex/Pipeline/RequestLogPerformanceMiddleware.cs

@ -14,7 +14,6 @@ namespace Squidex.Pipeline
{
public sealed class RequestLogPerformanceMiddleware : IMiddleware
{
private const int LongOperationsMs = 1000;
private readonly ISemanticLog log;
public RequestLogPerformanceMiddleware(ISemanticLog log)

2
src/Squidex/Program.cs

@ -9,8 +9,6 @@ using System.IO;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging;
using Orleans;
using Orleans.Hosting;
using Squidex.Config;
using Squidex.Infrastructure.Log.Adapter;

Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save