[英]How i can get elements from DB which exists in my local collection?
here is code 这是代码
var tempEnities =
_dc.VKEntities.Where(
z => enities.Any(x => x.Name==z.Name && x.Type==z.Type) ).
ToList();
enities
is my local collection. enities
是我的本地收藏。
Well ofcourse this code doesnt work because of linq2sql cannt translate Any to sql. 那么这个代码没有用,因为linq2sql无法将Any转换为sql。 Haw can i do it right?
哇,我可以做对吗?
Try this one: 试试这个:
var tempEnities =
from db in _dc.VKEntities
join local in enities on new { db.Name, db.Type }
equals new {local.Name, local.Type}
select db;
Some thing like this has been asked quite a few times. 这样的事情已被问过很多次了。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.