Prev | Current Page 181 | Next

Satheesh, N Kumar

"LINQ Quickly"

We will use the
DataContext method and the entity classes to access the stored procedure result-sets.
The stored procedure is like this. The stored procedure will return two result-sets;
one is from the Categories table, and the other from the Items table. Following is
the SQL syntax for the stored procedure:
CREATE PROCEDURE [dbo].[MultipleResults]
AS
select * from Categories
select * from Items
The corresponding DataContext method for this stored procedure would be
as follows:
[Function(Name = "dbo.MultipleResults")]
[ResultType(typeof(Categories))]
[ResultType(typeof(Items))]
public IMultipleResults MultipleResults()
{
IExecuteResult result = this.ExecuteMethodCall(this,
((MethodInfo)(MethodInfo.GetCurrentMethod())));
return ((IMultipleResults)(result.ReturnValue));
}
In the previous method declaration, note the ResultType attribute used for the
number of results expected from the output and their type. In the stored procedure,
we are using two SQL queries; one for returning the categories and the other for
returning the items.


Pages:
169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193
elektrodrążarki Ciąża newsy ze świata opakowania foliowe poker online