Browse Source

Nullable fixes.

pull/525/head
Sebastian 6 years ago
parent
commit
e7c4333b5a
  1. 12
      backend/src/Migrations/Migrations/PopulateGrainIndexes.cs
  2. 2
      backend/src/Squidex.Domain.Apps.Core.Model/Contents/IdContentData.cs
  3. 3
      backend/src/Squidex.Domain.Apps.Core.Model/Contents/NamedContentData.cs
  4. 4
      backend/src/Squidex.Infrastructure/EventSourcing/Grains/EventConsumerGrain.cs
  5. 2
      backend/src/Squidex.Infrastructure/Json/Objects/JsonObject.cs
  6. 8
      backend/src/Squidex.Infrastructure/Net/IPAddressComparer.cs
  7. 2
      backend/src/Squidex.Infrastructure/Orleans/Indexes/UniqueNameIndexGrain.cs
  8. 3
      backend/src/Squidex.Infrastructure/Reflection/Equality/DeepEqualityComparer.cs
  9. 3
      backend/src/Squidex.Infrastructure/Security/Permission.cs

12
backend/src/Migrations/Migrations/PopulateGrainIndexes.cs

@ -55,24 +55,24 @@ namespace Migrations.Migrations
bool HasApp(NamedId<Guid> appId, bool consistent, out Guid id)
{
return appsByName.TryGetValue(appId.Name, out id) && (!consistent || id == appId.Id);
return appsByName!.TryGetValue(appId.Name, out id) && (!consistent || id == appId.Id);
}
HashSet<Guid> Index(string contributorId)
{
return appsByUser.GetOrAddNew(contributorId);
return appsByUser!.GetOrAddNew(contributorId);
}
void RemoveApp(NamedId<Guid> appId, bool consistent)
{
if (HasApp(appId, consistent, out var id))
{
foreach (var apps in appsByUser.Values)
foreach (var apps in appsByUser!.Values)
{
apps.Remove(id);
}
appsByName.Remove(appId.Name);
appsByName!.Remove(appId.Name);
}
}
@ -125,7 +125,7 @@ namespace Migrations.Migrations
HashSet<Guid> Index(RuleEvent @event)
{
return rulesByApp.GetOrAddNew(@event.AppId.Id);
return rulesByApp!.GetOrAddNew(@event.AppId.Id);
}
await eventStore.QueryAsync(storedEvent =>
@ -157,7 +157,7 @@ namespace Migrations.Migrations
Dictionary<string, Guid> Index(SchemaEvent @event)
{
return schemasByApp.GetOrAddNew(@event.AppId.Id);
return schemasByApp!.GetOrAddNew(@event.AppId.Id);
}
await eventStore.QueryAsync(storedEvent =>

2
backend/src/Squidex.Domain.Apps.Core.Model/Contents/IdContentData.cs

@ -47,7 +47,7 @@ namespace Squidex.Domain.Apps.Core.Contents
return this;
}
public bool Equals(IdContentData other)
public bool Equals([AllowNull] IdContentData other)
{
return base.Equals(other);
}

3
backend/src/Squidex.Domain.Apps.Core.Model/Contents/NamedContentData.cs

@ -6,6 +6,7 @@
// ==========================================================================
using System;
using System.Diagnostics.CodeAnalysis;
using Squidex.Infrastructure;
namespace Squidex.Domain.Apps.Core.Contents
@ -63,7 +64,7 @@ namespace Squidex.Domain.Apps.Core.Contents
return clone;
}
public bool Equals(NamedContentData other)
public bool Equals([AllowNull] NamedContentData other)
{
return base.Equals(other);
}

4
backend/src/Squidex.Infrastructure/EventSourcing/Grains/EventConsumerGrain.cs

@ -201,7 +201,7 @@ namespace Squidex.Infrastructure.EventSourcing.Grains
private async Task ClearAsync()
{
var logContext = (actionId: Guid.NewGuid().ToString(), consumer: eventConsumer.Name);
var logContext = (actionId: Guid.NewGuid().ToString(), consumer: eventConsumer!.Name);
log.LogDebug(logContext, (ctx, w) => w
.WriteProperty("action", "EventConsumerReset")
@ -224,7 +224,7 @@ namespace Squidex.Infrastructure.EventSourcing.Grains
var eventId = @event.Headers.EventId().ToString();
var eventType = @event.Payload.GetType().Name;
var logContext = (eventId, eventType, consumer: eventConsumer.Name);
var logContext = (eventId, eventType, consumer: eventConsumer!.Name);
log.LogDebug(logContext, (ctx, w) => w
.WriteProperty("action", "HandleEvent")

2
backend/src/Squidex.Infrastructure/Json/Objects/JsonObject.cs

@ -113,7 +113,7 @@ namespace Squidex.Infrastructure.Json.Objects
return Equals(obj as JsonObject);
}
public bool Equals(IJsonValue other)
public bool Equals([AllowNull] IJsonValue other)
{
return Equals(other as JsonObject);
}

8
backend/src/Squidex.Infrastructure/Net/IPAddressComparer.cs

@ -6,6 +6,7 @@
// ==========================================================================
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Net;
namespace Squidex.Infrastructure.Net
@ -18,8 +19,13 @@ namespace Squidex.Infrastructure.Net
{
}
public int Compare(IPAddress x, IPAddress y)
public int Compare([AllowNull] IPAddress x, [AllowNull] IPAddress y)
{
if (x == null || y == null)
{
return 0;
}
var lbytes = x.GetAddressBytes();
var rbytes = y.GetAddressBytes();

2
backend/src/Squidex.Infrastructure/Orleans/Indexes/UniqueNameIndexGrain.cs

@ -116,7 +116,7 @@ namespace Squidex.Infrastructure.Orleans.Indexes
{
state.Value.Names.TryGetValue(name, out var id);
return Task.FromResult(id);
return Task.FromResult(id!);
}
public Task<List<T>> GetIdsAsync()

3
backend/src/Squidex.Infrastructure/Reflection/Equality/DeepEqualityComparer.cs

@ -6,6 +6,7 @@
// ==========================================================================
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
namespace Squidex.Infrastructure.Reflection.Equality
{
@ -19,7 +20,7 @@ namespace Squidex.Infrastructure.Reflection.Equality
this.comparer = comparer ?? SimpleEquals.Build(typeof(T));
}
public bool Equals(T x, T y)
public bool Equals([AllowNull] T x, [AllowNull] T y)
{
return comparer.IsEquals(x, y);
}

3
backend/src/Squidex.Infrastructure/Security/Permission.cs

@ -6,6 +6,7 @@
// ==========================================================================
using System;
using System.Diagnostics.CodeAnalysis;
namespace Squidex.Infrastructure.Security
{
@ -112,7 +113,7 @@ namespace Squidex.Infrastructure.Security
return id;
}
public int CompareTo(Permission other)
public int CompareTo([AllowNull] Permission other)
{
return other == null ? -1 : string.Compare(id, other.id, StringComparison.Ordinal);
}

Loading…
Cancel
Save