Prev | Current Page 183 | Next

Satheesh, N Kumar

"LINQ Quickly"

[RuntimeShapesforResults](@param nvarchar(20))
AS
IF(@param = ???Items')
SELECT * FROM Items
ELSE IF(@param ='Categories')
SELECT * FROM Categories
The stored procedure returns all the rows from the Items table if the passed
parameter value is equal to Items, and it returns all data from the Categories table
if the parameter value is equal to Categories.
The equivalent DataContext class method for the previous stored procedure would
be as follows:
[Function(Name = "dbo.RuntimeShapesforResults")]
[ResultType(typeof(Categories))]
[ResultType(typeof(Items))]
public IMultipleResults RuntimeShapesforResults
([Parameter(DbType = "int")] System.Nullable param)
{
IExecuteResult result = this.ExecuteMethodCall(this,
((MethodInfo)(MethodInfo.GetCurrentMethod())), param);
return ((IMultipleResults)(result.ReturnValue));
}
LINQ to SQL
[ 116 ]
Following is the code for calling the stored procedure and getting the results by
passing the parameter value. If we pass the value 1 to the parameter, the result
would be the list of Categories, and if the parameter value is 2 then the result
would be the list of Items.


Pages:
171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195
życzenia urodzinowe wierszyki szambo betonowe typy bukmacherskie Tango Olsztyn