-
Notifications
You must be signed in to change notification settings - Fork 350
Closed
Labels
Description
The default implementation of DbDataReader.GetStream creates a new MemoryStream and copies the data returned by GetBytes into it, in a loop.
A better implementation would be to create a read-only MemoryStream directly on the backing store for the row.
This does raise a question about the lifetime of the Stream, though: its backing memory would be overwritten as soon as DbDataReader.Read is called again. Is there any documentation on whether consumers can use the returned Stream after calling Read again, or after closing the DbDataReader? (Since, with Connector/NET, these behaviours are implicitly allowed due to the way the Stream is created, there may well be existing code that relies on it.)
Reactions are currently unavailable