如何使用LINQ比较两个不同的模型 [英] How do I compare two different Models using LINQ
问题描述
下面的代码显示了两个不同的数据源,一个是Webservice,另一个是本地数据库。 我在这里要完成的是在远程数据库中选择项目不在本地数据库中的产品。 在SQL中,我将运行
以下脚本。
从RemoteLink.Database.dbo.Product rm 中选择rm.ProductID ;其中rm.ProductID 不在
(
选择matnum作为ProductID 来自Database.dbo.matm
)
那么如何在LINQ查询中编写它。 这是我目前的代码。 非常感谢
LINQ代码
dbEntities _remoteService =新dbEntities(新URI(" HTTP://本地主机:51348 / InventoryServices / ProductService.svc /"));
 &NBSP ;                
0
The code below shows two different data sources, one is a Webservice and another is a local Database. What I'm trying to accomplish here is to select the product in the Remote DB where the items are not in the local DB. in SQL, I Would run the following script.
Select rm.ProductID from RemoteLink.Database.dbo.Product rm where rm.ProductID not in
(
Select matnum as ProductID from Database.dbo.matm
)
So how do I write it in LINQ query. This is my current code below. Thanks alot
LINQ Code
// Remote DB
dbEntities _remoteService = new dbEntities(new Uri("http://localhost:51348/InventoryServices/ProductService.svc/"));解决方案0
这篇关于如何使用LINQ比较两个不同的模型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文登录 关闭
扫码关注1秒登录发送“验证码”获取 | 15天全站免登陆