LINQ
has some advantages but it is absolutely incorrect to say that LINQ is a
better approach than a stored proc. As with anything computer related
there are no absolutes in the best way to approach things. LINQ is
typesafe, you don't sql syntax errors at runtime (they are discovered at
compile time), it does not handle long iterations very well. There are
good and bad things as with any technology. Personally I don't use LINQ
as my database tool, I write procs. I do however leverage the power of
LINQ frequently when dealing with generics.
You might try a
google search for "advantages of linq over stored procedure". You will
find lots of discussions on this topic. Just keep in mind that any
discussion on a topic such as this is filled with opinions and typically
few actual facts.
//---------------------------------------------------------
linq is for front end developers who have to build a database driven site w/o having extensive sql development knowledge.
u
can prob write linq in a fashion that it would be as optimized as a
proc however the biggest difference in my opinion between using linq or
procs is the whole code reuse aspect of procs. I'm not a fan of inline
sql in code. It will work for a small sites however it gets out of hand
real quick. Or worse, which is how it is at my current location. There
is a mishmash of inline sql and stored procs and we're too large to take
the time to clean it up. That's what happens.
if u create a
data access layer and use stored procs it will always be the way to go.
The problem is there just aren’t that many front end developers who take
the time to get good at the backend coding. I'm not blaming them. I'm
not the most savvy front end developer. They're using the tools they
know how to.
Long and short. Stick w/ Data access layer and stored procs and u will save urself a lot of time in the future.
//------------------------------
really
it is impossible to write your programs with linq and be sure that your
performance is like procedure ,because when you in linq you have to put
your code in the application layer and you should send all query to the
database engine (before sending your query ,your query should be
translated to sql syntax)but in procedure you should send your variables
and your query is in the database .
No comments:
Post a Comment