public static bool RunContains(string runId, string IdentityHash) { if (!WriteObjectCollections.TryTake(out ILiteCollection <WriteObject>?col)) { col = db?.GetCollection <WriteObject>(); } var output = col?.Exists(y => y.RunId == runId && y.Identity == IdentityHash); if (col is ILiteCollection <WriteObject> ) { WriteObjectCollections.Add(col); } return(output ?? false); }
public static WriteObject?GetWriteObject(string RunId, string IdentityHash) { if (!WriteObjectCollections.TryTake(out ILiteCollection <WriteObject>?col)) { col = db?.GetCollection <WriteObject>(); } var output = col?.FindOne(x => x.Identity == IdentityHash && x.RunId == RunId); if (col is ILiteCollection <WriteObject> ) { WriteObjectCollections.Add(col); } return(output); }