Any ideas what the problem might be here on an EF DbContext query? As far as I have understood, this should work according to a fellow SO poster.
I've tried Lists, null, not null checks, to no avail. The query does work however, if I remove the null check and just leave the Contains()
. However, it is a requirement to return all records if testIDs is null.
var testIDs = new int[] { 1, 3 };
var test = session.All<VendorBooking>(x => testIDs == null || testIDs.Contains(x.VendorServiceID)).ToList();
(session.All simply utilises context.Set<T>.Where()
)
Exception thrown: 'System.NotSupportedException' in EntityFramework.SqlServer.dll
Additional information: Cannot compare elements of type 'System.Int32[]'. Only primitive types, enumeration types and entity types are supported.
Many thanks