Raiso Thiện
Raiso Thiện

Reputation: 33

Where contains throw Value can't be null

I'm stuck and don't know why this issue occurs.

Normally we do like this:

var q = await OrmDb.SelectAsync<OrmProductSerial>(p => p.SerialNumber.Contains(reqSearch) );

In this case I need do like this, but it throws an error. Doesn't ormlite support this ? ( linq can do it )

var q = await OrmDb.SelectAsync<OrmProductSerial>(p => reqSearch.Contains(p.SerialNumber) );

Thanks.

Upvotes: 2

Views: 134

Answers (1)

Salah Akbari
Salah Akbari

Reputation: 39966

Based on this, for ormlite, you need to use Sql.In instead, something like this:

OrmDb.SelectAsync<OrmProductSerial>(p => p.Where(c => Sql.In(c.SerialNumber,reqSearch)));

Upvotes: 1

Related Questions