数据库对应EFCore操作

数据库对应EFCore操作

1,查某个id在某个集合被包含的数据

例如: 查 Id 在ids里的结合

            //实现的sql是实体Id in ids,也就是ids跟Id 两个集合的交集
            var _ainfcfgs = await _ainfcfgServices.GetListAsync(x => ids.Contains(x.Id));

2.查某id集合不被某集合包含的数据

例如:查Id不被countryUpdateCityIds包含的城市

 var countryUpdateCityIds = countryUpdateResource.Cities.Select(x => x.Id).ToList();
 var removedCities = country.Cities.Where(c => !countryUpdateCityIds.Contains(c.Id)).ToList();
posted @ 2020-07-22 13:45  JerryMouseLi  阅读(393)  评论(0编辑  收藏  举报