AI OnAI Off
Sure thing. (This has something to do with me, actually). I will file a bug and will work on it soon. Thanks for bringing it to our attention.
In the meanwhile if you need a work around, please use this snippet:
OrderSearchOptions options = new OrderSearchOptions { Namespace = OrderNamespace };
options.Classes.Add(PurchaseOrderClassType);
options.RecordsToRetrieve = int.MaxValue;
OrderSearchParameters parameters = new OrderSearchParameters();
if (statuses.Length > 0)
{
parameters.SqlWhereClause = $" Status IN ({string.Join(",", statuses.Select(s => $"'{s}'"))})";
}
return OrderContext.Current.Search<PurchaseOrder>(parameters, options, out int _);
We indeed implemented something similar using a wrapper class which we use for testability in mocked objects. Thanks for the workaround anyway!
Yesterday we installed the latest version of Episerver Commerce. It seems that the way how FindPurchaseOrdersByStatus method in OrderContext works has been changed. Already dived into the decompiled code and found out that there is a bug in the query which is executed. The single quotes are missing in the IN operator in the Where Clause, which causes SQL to return the error "Invalid column name 'InProgress'" when filtering on all orders which are InProgress. Can this be logged as bug?