diff --git a/src/BitzArt.Flux.Json/Models/FluxJsonSetContext{TModel,TKey}.cs b/src/BitzArt.Flux.Json/Models/FluxJsonSetContext{TModel,TKey}.cs index 5865e66..532ce99 100644 --- a/src/BitzArt.Flux.Json/Models/FluxJsonSetContext{TModel,TKey}.cs +++ b/src/BitzArt.Flux.Json/Models/FluxJsonSetContext{TModel,TKey}.cs @@ -34,7 +34,7 @@ public Task GetAsync(TKey? id, params object[]? parameters) if (SetOptions.KeyPropertyExpression is null) throw new FluxKeyPropertyExpressionMissingException(); var itemId = SetOptions.KeyPropertyExpression.Compile().Invoke(item); - return Equals(itemId, id); + return itemId is not null && itemId.Equals(id); }) ?? throw new FluxItemNotFoundException(id); return Task.FromResult(existingItem); diff --git a/src/BitzArt.Flux.Json/Models/FluxJsonSetContext{TModel}.cs b/src/BitzArt.Flux.Json/Models/FluxJsonSetContext{TModel}.cs index addb472..1a84e1c 100644 --- a/src/BitzArt.Flux.Json/Models/FluxJsonSetContext{TModel}.cs +++ b/src/BitzArt.Flux.Json/Models/FluxJsonSetContext{TModel}.cs @@ -77,7 +77,7 @@ public virtual Task GetAsync(object? id, params object[]? parameters) if (SetOptions.KeyPropertyExpression is null) throw new FluxKeyPropertyExpressionMissingException(); var itemId = SetOptions.KeyPropertyExpression.Compile().Invoke(item); - return Equals(itemId, id); + return itemId.Equals(id); }) ?? throw new FluxItemNotFoundException(id); return Task.FromResult(existingItem);