var listimportDataEOIResoults = importDataEOIResoults.Select(i => i.ProductSelectionId).ToList(); var productSelections = _efWorker.ProductSelectionRepository.FindAll( filter: ps => listimportDataEOIResoults.Contains(ps.Id));
需要注意的是不能这样写:
var productSelections = _efWorker.ProductSelectionRepository.FindAll( filter: ps => importDataEOIResoults.Select(i => i.ProductSelectionId).ToList().Contains(ps.Id));
需要先提取出具体的list才能在EF中使用Contains(也就是In操作)
时间: 2024-09-29 00:58:52