views:

33

answers:

1

Does someone out there use stored procedures with linq to sql and why? Should we use them? Their support is there in linq to sql. I am asking because I use to use it before my recent application.

A: 

Stored procedures are use for

Encapsulation of business logic: Stored procedures allow for business logic to be embedded as an API in the database, which can simplify data management and reduce the need to encode the logic elsewhere in client programs. This may result in a lesser likelihood of data becoming corrupted through the use of faulty client programs. Thus, the database system can ensure data integrity and consistency with the help of stored procedures.

where as linq to sql allow us to query data, to do simple insert and update but to do some complex logic we need to do the code in out class files.

Fore example consider UserLogin form :

where i have to check user exits or not, is use enter password valid or not and also have to check the authority i.e module rights FOR THIS IF I USE STORED PROCEUDRE I AN DO ALL THING IN ON SP

and if i use linq i have to do coding for check user first than have to check for the module rights one by one

Actually do not compare Stored proceudre with the linq2sql both are different things.

Pranay Rana