在LINQ临时表到实体 [英] Temp table in LINQ to Entities

查看:141
本文介绍了在LINQ临时表到实体的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有用户ID是巨大的表。结果
我有我想要的用户ID的数组。结果
我有有一个国外的用户ID键两个表。

什么是明智的获取此信息性能的最佳方式?

在理想的情况下SQL最后的结果会是有点像这个(空值,如果没有用户ID在一个表而不是其他):

 用户ID table1value table2value
1空12
5 123空


解决方案

我有去年同样的问题,然后当它来表现,那么而不采取临时表中持有记录(应用程序结束或服务端)O搬到LINQ to SQL和做了一个存储过程,并把它称为通过实体,如LINQ到存储过程=)。而我的存储过程中所做的一切,回到只有那些我想记录和我没有在存储过程结束分页到让我在一个时间,而不是在应用程序中所有的数据得到的数据有限。

不要让我知道如果你需要任何帮助。我会给一个code片段了。

I have a table of user ids that is huge.
I have an array of user ids that I want.
I have two tables that have a foreign user id key.

What is the best way to get this information performance wise?

Ideally in SQL the final result would be somewhat like this (null values if there is no user ID in one table but not the other):

userid  table1value table2value
1        null          12
5        123           null

解决方案

I was having the same issue last year and then when it came to performance, then instead of taking temp table for holding records (application end or service end) O moved to LINQ to SQL and made a stored procedure and called it through entities like LINQ to stored procedure =). And my stored procedure did all and returned only those records that I wanted and I did paging to at the stored procedure end so that I got limited data at a time rather than all data at application.

Do let me know if you need any help in that. I will give a code snippet too.

这篇关于在LINQ临时表到实体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆