How to save a file in a SQL Server 2008 database using Entity Framework?
I want to use FileStream in SQL Server 2008.
I donβt understand why this will not work - the columns filestreamare only displayed as varbinary(MAX), so you can set the column using Entity Framework:
filestream
varbinary(MAX)
An example is here :
Files newFile = new Files(); newFile.FileID = Guid.NewGuid(); newFile.FileContents = System.IO.File.ReadAllBytes("TextFile1.txt"); ctx.AddObject("Files", newFile); ctx.SaveChanges();
Entity infrastructure does not support specific SQL server features such as filestream. You cannot do this with EF, you must return to ADO.NET.
Edit:
Undeleting , , EF FILESTREAM. EF FILESTREAM, , @BrokenGlass . , EF FILESTREAM FILESTREAM. .
FILESTREAM