Where contains throw Value can't be null

狂风中的少年 提交于 2020-04-15 22:43:57

问题


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.


回答1:


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)));


来源:https://stackoverflow.com/questions/60108806/where-contains-throw-value-cant-be-null

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!