开发者

How is Linq-to-Sql abused?

I hear a lot of linq-to-sql bashing and how people will unknowingly abuse it. But how is linq-to-sql being abused?

Update If someone can give me clear examples of how it's abused that would be very helpful. References to blogs/tutorials wo开发者_JAVA百科uld be very helpful as well. Thanks.


One of the easiest mistakes to make is to create a query which results in a loop of calls to the database instead of a single call returning all the data. For this reason it's worth checking what sql commands are hitting the database either in the debugger or with a trace.


There are many ways that LINQ->SQL can be abused just like poorly written inline SQL/ADO.NET/SPs or what have you.

Alot of what you might have heard is how LINQ itself might be abused.


I think one example of it being misused would be as a total replacement for SQL in views or stored procedures on the server, and therefore potentially more lax security on the database server.


Well... if you can write complicated queries with linq-to-sql it's probably because you know SQL syntax and are pretty good at writting the query in SQL in the first place. So why would you use the .NET syntax to write a syntax tree that then another layer of software would translate (perhaps not very efficiently) into SQL for you? Just write the damn thing in SQL in the first place :-)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜