Stored Procedure, when to use Output parameter vs Return variable

前端 未结 7 1441
不思量自难忘°
不思量自难忘° 2020-12-28 12:54

When would you use an output parameter vs a return variable, or vice versa? In the following simple example, I can achieve the same thing using either one.

Using out

7条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-28 13:21

    I use return value to many things because it is more performative such as:

    1 - When you insert or change an item when I do the validation in the database Return positive number to return the Identity and negative with the number of the error, it is faster.

    2- When I make an appointment with paging use it to return the total amount of records is also faster and less costly. For the rest I use Output when there are several returns or different types of int. And of course I use recorset to return a list of items

    How do I use the Dapper to make my queries I do not suffer.

提交回复
热议问题