在LINQ的存储过程 [英] Linq over Stored Procedures

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

问题描述

什么是使用LINQ在存储过程的一些优点和缺点是什么?

What are some pros and cons of using linq over stored procedures?

推荐答案

LINQ是一个美好的,除了.Net框架,它,然而,有它的局限性。作为尚未LINQ还不支持所有的SQL语法(虽然我敢肯定,他们正在努力就可以了)。此外,使用LINQ有拥有它处理多个表,并给我们的只有我们需要的数据没有干净的方式。随着LINQ你会检索所有数据,然后让你想要什么,并扔休息了,因此传输更多的数据比实际需要的,这是一个性能问题。

LINQ is a wonderful addition to the .Net Framework, it does, however, have it's limitations. As of yet LINQ does not yet support all of the SQL Syntax (though I'm sure they're working on it). Also, with LINQ there is no clean way of having it process multiple tables and give us only the data we need. With LINQ you would have to retrieve all the data, then keep what you want and throw the rest out, thus transmitting more data than is actually needed, which is a performance issue.

如果你正在做的是简单的INSERT,UPDATE和DELETE语句LINQ是要走的路(在我看来),所有的优化为你做的,对于较复杂的工作,我会说坚持使用存储过程

If all you're doing is simple INSERT, UPDATE, and DELETE statements LINQ is the way to go (in my opinion) and all the optimization is done for you, for more complex work I would say to stick with stored procedures.

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

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