Upgrading to WebDAV Server Engine .NET v10
In this article
Upgrading to WebDAV Server Engine .NET v10
The WebDAV Server Engine v10 provides full support for asynchronous IO read and write operations and IAsyncDisposable interface.
The v10 is fully backward compatible with v9. You do not need to change your existing code unless you want to utilize asynchronous object disposing and asynchronous IO. As soon as you reference new packages from NuGet, your existing code will start working immediately.
All streams provided by the Engine support both synchronous and asynchronous reading and writing as well as support both IAsyncDisposable and IDisposable interfaces. You can use either of them.
Upgrading Your Code to Use the Asynchronous IO
To make sure your code is using asynchronous IO set the AllowSynchronousIO to false:
options.AllowSynchronousIO = false;
In most cases, you have already updated your code to utilize asynchronous streams. If you still have synchronous read and write calls, such as Stream.Read() and Stream.Write() it is time to replace them with await Stream.ReadAsync() and await Stream.WriteAsync() method calls to utilize the full power of the .NET Core asynchronous streams and updated WebDAV Engine.
Upgrading Your Code to Use the IAsyncDisposable Interface
While most of the changes in objects asynchronous disposing is done inside the updated Engine, there is some code that you may wish to upgrade. If your WebDAV Context is implementing IDisposable interface now you can implement IAsyncDisposable interface:
public class DavContext : ContextCoreAsync<IHierarchyItemAsync> , IDisposable, IAsyncDisposable { ... public async ValueTask DisposeAsync() { ... } ... }
In case you are using .NET Core and creating your context as the following:
services.AddScoped<ContextCoreAsync<IHierarchyItemAsync>, DavContext>();
.NET Core will automatically recognize and use the IAsyncDisposable interface and the DisposeAsync() method.
Otherwise use the await using directive:
await using(DavContext context = new DavContext()) { ... }