LINQ to SQL will inject Stored Procedure ?!

I have attended a day course that was created by Michele Leroux Bustamante.

One of the thing that was communicated in the day course was that LINQ to SQL will actually inject stored procedure for each query you are creating (it will also handle the caching of them and etc).

From my point of view this means that LINQ to SQL will never be used directly inside an ASP.NET or other application because that would mean that the process identity will have to have enough rights to inject the stored procedure and who will approve that.

I didn't get any information that it would be configurable behavior.

The only reason that I can think of my self that can cause such behavior is to MAYBE enable the stored procedure to be altered by DBA and that makes some sense (this will reduce the usual syntax from the DBA saying "I will let you write C# and you will let me write SQL")

In the link provide above to LINQ to SQL you can find a text that says "LINQ to SQL is designed to be non-intrusive to your application" and I find it a little funny because what can be more intrusive than altering the DB :)

Currently I didn't find any indication of this behavior but you can be sure that I will update my article in the near future.

LINQ to SQL will inject Stored Procedure ?! LINQ to SQL will inject Stored Procedure ?! Reviewed by Ran Davidovitz on 1:54 PM Rating: 5

2 comments:

Anonymous said...

If I understood you are completely wrong. LINQ will generate dynamic SQL code from your C# code. Just it. LINQ will not create or alter any of your procedures.

Ran Davidovitz said...

I agree, i never got a reply from her / other.
I guess they had a mistake,
I decided to leave this blog item

Thanks for the comment

Powered by Blogger.