When i want to store a file in a filestream column, i always need to read the whole binary into the memory:
using (MemoryStream memoryStream = new MemoryStream())
{
sourceStream.CopyTo(memoryStream);
binaryStore.Content = memoryStream.ToArray(); //Content = filestream column
}
is there a way with the entity framework, to put the stream directly? Because, if i want to upload a large file, i get a OutOfMemoryException.
Didn't see any update about FILESTREAM support in EF. (Mentioned before as partial support with .net 3.5 sp1 release here). I suppose entity framework is accessing FILESTREAM through TSQL and apparent that you will not be able to get the streaming performance benefits of FILESTREAM. (need to read all file content into memory)
So, the recommended approach is using with SqlFileStream
.Net API.