I am manually calling a stored procedure using an Entity Framework EntityConnection like so:
DbConnection storeConnection = entityConnection.StoreConnection;
DbCommand command = storeConnection.CreateCommand();
command.CommandText = "sp_GetMyComplexData";
command.CommandType = CommandType.StoredProcedure;
DbDataReader reader = command....
I'm executing a number of SQL query's as a batch and then getting all of the result sets back in a batch. The way that my code is currently put together, the first result set gets skipped. Now that I know this, I could simply throw in another statement outside of my loop that grabs the first result, however I'm wondering if there is a ...
I have an extension method to convert a DbDataReader to an IEnumerable object:
public static IEnumerable<IDataRecord> AsEnumerable(this DbDataReader reader) {
while (reader.Read()) {
yield return reader;
}
}
In my application, I query the database like so:
var records = context.Query("select WRKORDNBR from WRKORDER")....
Does anyone know how DbDataReaders actually work. We can use SqlDataReader as an example.
When you do the following
cmd.CommandText = "SELECT * FROM Customers";
var rdr = cmd.ExecuteReader();
while(rdr.Read())
{
//Do something
}
Does the data reader have all of the rows in memory, or does it just grab one, and then when Read is c...