Accessing a BLOB file in the database using LINQ works like this:
var query = from file in database
where file.FileID = fileId
select file;
When I activate Filestream on this table LINQ queries the database via T-SQL. Which is a bad practice on larger files.
According to this site: http://www.codeproject.com/Articles/128657/How-Do-I-Use-SQL-File-Stream it should be done with a SqlCommand
, query for the path and then access the file directly with SqlFileStream
.
Select FileData.PathName() As Path,
GET_FILESTREAM_TRANSACTION_CONTEXT() As TransactionContext
From PictureTable Where PkId = (Select Max(PkId) From PictureTable)
Is now possible to access the file in a slicker (more "LINQ-er") fashion?