简体   繁体   English

我如何从我本地收藏中存在的DB中获取元素?

[英]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.

相关问题 如何对本地网络中的所有设备执行ping操作并获得响应? - How can I ping all devices which are in my local network and get responce from them? 如何更好地从集合中的集合中获取一个集合? - How can I better get a collection from a collection within a collection? 如何确定哪个值在我的收藏中出现最多? - How can I determine which value occurs the most in my collection? 如何将第二个集合中不存在的一个集合中的元素添加到第三个集合中? - How can I add elements from one collection that do not exist in a second collection to a third collection? 如何获取 PostgreSQL 服务器上每个数据库的大小 - How can i get the size of every db on my PostgreSQL server 如何从集合中获取所有嵌套项目? - How can I get all nested items from a collection? 如何从集合中获取一个属性并将其分配给数组? - How can I get one property from a collection and assign it to an array? 如何从1个集合中找到与第二个集合中的元素部分匹配的元素? - How to find elements from 1 collection which partially matches elements in a second collection? 宇宙DB。 我希望所有数据都在同一集合中。 我可以无限收藏吗? - Cosmos DB. I want all my data in same collection. Can I achieve this with an unlimited collection? 如何让我的双打显示存储它们的小数? - How can I get my doubles to display the decimals with which they are stored?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM