You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Since you require document to provide a writeable stream, that makes usage in some scenarios unnecessarily difficult. Though it works well for the implemented file storage and memory storage, which both possess writeable streams, SQLiteBlobWriteStream.cs already looks cumbersome and needs to buffer the whole stream, defeating the purpose of streaming.
My suggestion is thus to pass the input stream to the document and let it handle the further processing. For the lines mentioned above, I used
This allows to write the following code (in shortened form). Note that the input stream is passed directly to the database, without requiring to buffer the whole file.
publicasync Task WriteAsync(Streamstream,intstartPosition,intcontentLength,CancellationTokenct){using(varconnection= context.Database.GetDbConnection()){await connection.OpenAsync();using(varcommand= connection.CreateCommand()){
command.CommandText ="UPDATE file_data SET file=@file WHERE id=@id";
command.Parameters.AddWithValue("id", id);
command.Parameters.AddWithValue("file", stream);await command.ExecuteNonQueryAsync(ct);}}}
Since changing the method signatures of CreateAsync and WriteAsync is significant, it would break all previously implemented clients. I leave it up to you to decide whether to go this route.
Cheers, Fabian
The text was updated successfully, but these errors were encountered:
Hi,
first of all: thanks for the nice library!
I have one concern regarding the stream handling in PutHandler.cs
WebDavServer/src/FubarDev.WebDavServer/Handlers/Impl/PutHandler.cs
Lines 117 to 130 in a11219e
Since you require document to provide a writeable stream, that makes usage in some scenarios unnecessarily difficult. Though it works well for the implemented file storage and memory storage, which both possess writeable streams,
SQLiteBlobWriteStream.cs
already looks cumbersome and needs to buffer the whole stream, defeating the purpose of streaming.My suggestion is thus to pass the input stream to the document and let it handle the further processing. For the lines mentioned above, I used
This allows to write the following code (in shortened form). Note that the input stream is passed directly to the database, without requiring to buffer the whole file.
Since changing the method signatures of
CreateAsync
andWriteAsync
is significant, it would break all previously implemented clients. I leave it up to you to decide whether to go this route.Cheers, Fabian
The text was updated successfully, but these errors were encountered: