0

According to MSDN (http://msdn.microsoft.com/en-us/library/dd487208.aspx), there is an object called DbDataReader that is created in the process of running a SQL query in Entity Framework.

Entity Framework "translates" the DbDataReader into a entity class.

How can I access the DbDataReader directly?

Vivian River
  • 31,198
  • 62
  • 198
  • 313
  • I was hoping that there is some way to access the values returned from SQL directly while still having the benefit of having EF manage connections and all the rest. – Vivian River May 08 '12 at 22:11

1 Answers1

1

You can access the data reader it if you execute the query yourself:

using (var command = context.Connection.CreateCommand())
{
    command.CommandText = "SELECT ...3;
    using (var reader = command.ExecuteReader())
    {
        ...
    }
}
Thomas Levesque
  • 286,951
  • 70
  • 623
  • 758