You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As requested by the community, we need to add an additional argument to the Extract and Scalar method of the QueryMultipleExtractor class.
The call below is moving to the next result after calling the Extract.
using(varconnection=new SqlConnection(connectionString)){varcommandText="SELECT Id, Name FROM [dbo].[Customer] WHERE Id = @CustomerId; SELECT * FROM [dbo].[Order] WHERE CustomerId = @CustomerId;";using(varextractor= connection.ExecuteQueryMultiple(commandText,new{ CustomerId =10045})){varcustomer= extractor.Extract<Customer>().FirstOrDefault();// <-- This does not moves to the next resultvarorders= extractor.Extract<Order>().AsList();// <-- In the 2nd position// Do the stuffs for the 'customer' and 'orders' here}}
By passing a value of false to the argument isMoveToNextResult, then the data reader will not move the pointer.
using(varconnection=new SqlConnection(connectionString)){varcommandText="SELECT Id, Name FROM [dbo].[Customer] WHERE Id = @CustomerId; SELECT * FROM [dbo].[Order] WHERE CustomerId = @CustomerId;";using(varextractor= connection.ExecuteQueryMultiple(commandText,new{ CustomerId =10045})){varcustomer= extractor.Extract<Customer>(false).FirstOrDefault();// <-- This moves to the next result
extractor.NextResult();// <-- Manually moving to the next resultvarorders= extractor.Extract<Order>().AsList();// <-- In the 2nd position// Do the stuffs for the 'customer' and 'orders' here}}
The same scenario is the same for the Scalar method, and also to their corresponding Async methods. FYI: @cleverguy25
The text was updated successfully, but these errors were encountered:
mikependon
changed the title
Request: Add the 'isMoveToNextResult' argument to the QueryMultipleExtractor (Extract and Scalar)
Request: Add the 'isMoveToNextResult' argument to the QueryMultipleExtractor (Extract and Scalar) methods
Sep 22, 2020
As requested by the community, we need to add an additional argument to the
Extract
andScalar
method of the QueryMultipleExtractor class.The call below is moving to the next result after calling the
Extract
.By passing a value of
false
to the argumentisMoveToNextResult
, then the data reader will not move the pointer.The same scenario is the same for the
Scalar
method, and also to their correspondingAsync
methods. FYI: @cleverguy25The text was updated successfully, but these errors were encountered: