为什么需要存储过程时,我的LINQ to SQL [英] Why do I need Stored Procedures when I have LINQ to SQL

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

问题描述

我的LINQ的理解SQL是它把我的LINQ的声明,并把它转换成等价的SQL语句。

My understanding of Linq to Sql is it will take my Linq statement and convert it into an equivalent SQL statement.

于是

var products = from p in db.Products
               where p.Category.CategoryName == "Beverages"
               select p

刚刚变成

Select * from Products where CategoryName = 'Beverages'

如果是那样的话,我看不出存储过程不再是有用的。

If that's the case, I don't see how stored procedures are useful anymore.

推荐答案

存储过程是在框中的另一种工具。你可以使用你的想象力自动调节扳手的90%的任务,但你不能用闪亮的东西在剥离坚果。对于一个良好的醇'活动扳手是你最好的朋友。除非你打破螺栓,在这种情况下你不得不拥有组装。

Sprocs are another tool in the box. You might use your fancy automatically-adjusting wrench for 90% of your tasks, but you can't use that shiny thing on stripped nuts. For that a good ol' monkey wrench is your best friend. Unless you break the bolt, in which case you're stuck with assembly.

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

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