Support for streams instead of byte arrays for varbinary fields
Support for mapping System.IO.Stream to Binary fields
Reverting status from “under review” to “no status” since we aren’t currently working on this. We will still consider it for future releases.
Werner Strydom commented
We work with documents a lot and store them in the database. A stream makes sense as it can come in many forms, be it an http stream, file stream or memory stream. If the underlying provider supports streaming and chunking, it may also reduce fragmentation of the large object heap and ultimately performance of the system as a whole. This is a problem when many documents exceed 85k.
There are a number of examples how to upload large files to varbinary columns in SQL Server 2005.
In addition, when you read data, the byte array is often populated by EF, which itself causes memory problems, mentioned earlier. So EF can treat a stream as a lazy field and only connect to the database to download the large stream when really needed, while keeping memory requirements to a minimum.
Ladislav Mrnka commented
This request doesn't make sense. There is no streaming between database and application except FILESTREAM which works only per record and requires two different queries - it would be a very special type of per column lazy loading but it will be SQL Server only.
Eamon Nerbonne commented
Does SQL server itself even support lazy streams? Isn't that what FILESTREAM types are for? I.e. implementing this is effectively going to be a wrapper around something closely equivalent to MemoryStream - not much point...
Why would you be storing a 3GB binary blob/file in a database? You should store that in a file somewhere and then use a Stream to read it as necessary.
Vesel, hmmm... what about 3Gb byte-in-memory array?
I think, "Lazy Loading at Column Level" feature has the same general idea. May be merge?
I think of using a streaming contract rather than to convert all bytes to a stream on the client side.
Stream is abstract type. The only concrete type I see for mapping is MemoryStream. But If you need you can get MemoryStream from bytes with only one line of code
MemoryStream stream = new MemoryStream(bytes)