The first is an input parameter that is the ID of the salesperson.
The second is an OUPUT parameter, which will contain the maximum individual sales for the
given salesperson.
The next step is to create a mapping to that stored procedure and the associated parameters. In Visual
Studio, add the following code below the previous stored procedure mapping. Notice the additional
attribute, which is a Return attribute. It tells the mapping that a return value will be coming and the
data type of that value. Also notice that it defines the two parameters and the parameter types within
the method.
[Function(Name = "[MaxOrderBySalesPersonID]")]
[return: Parameter(DBType="int")]
public int MaxOrder
([Parameter(DBType = "int")] int salesPersonID,
[Parameter(DBType = "int")] ref int maxSalesTotal)
{
IExecuteResults results = this.ExecuteMethodCall(
this, ((MethodInfo)(MethodInfo.GetCurrentMethod())),
234
Chapter 11: LINQ to SQL Queries
salesPersonID, maxSalesTotal);
maxSalesTotal = ((int)(results.GetParameterValue(1)));
return ((int)(results.
Pages:
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382