1
我有一个查询跳过查询的一部分,如果项目文本为空
return uow.CustomerRepo
.Get()
.Where
(
c=>
c.Firstname.StartsWith(customerSearch.Initial) &&
c.Surname == customerSearch.Surname &&
c.Email == customerSearch.Email &&
c.Postcode == customerSearch.PostCode
)
有没有办法跳过查询的部分,如果东西customerSearch
是空的?
,所以我想跳过部分
c.Surname == customerSearch.Surname
如果
customerSearch.Surname
是空
我推荐'string.IsNullOrEmpty()' – BenVlodgi
非常感谢你 –