Alter bookmark expression to include correlation when its needed as 'this.CorrelationId == null' isnt trimmed in YesSql providing incorrect sql (#1634)

Co-authored-by: Matthew Green <Matthew.Green@brightstarr.com>
This commit is contained in:
Matthew Green 2021-10-13 12:33:47 +01:00 committed by GitHub
parent ab6b2515d0
commit cdf120dc0e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,4 +1,4 @@
using System;
using System;
using System.Linq.Expressions;
using Elsa.Models;
@ -16,10 +16,13 @@ namespace Elsa.Persistence.Specifications.Bookmarks
public string? TenantId { get; set; }
public string? CorrelationId { get; }
public string ActivityType { get; set; }
public override Expression<Func<Bookmark, bool>> ToExpression() => bookmark =>
bookmark.TenantId == TenantId &&
bookmark.ActivityType == ActivityType &&
(CorrelationId == null || bookmark.CorrelationId == CorrelationId);
public override Expression<Func<Bookmark, bool>> ToExpression() =>
CorrelationId == null
? bookmark => bookmark.TenantId == TenantId
&& bookmark.ActivityType == ActivityType
: bookmark => bookmark.TenantId == TenantId
&& bookmark.ActivityType == ActivityType
&& bookmark.CorrelationId == CorrelationId;
}
}