Upgrading Your Code to WebDAV Client Library for .NET v2.0
IT Hit WebDAV Client Library v2 for .NET provides asynchronous implementation that follow the Task-based Asynchronous Pattern (TAP). The new async implementation is located in \Async\ folder in the archive. The asynchronous version is also available as a NuGet package.
The v2 also provides synchronous version. The synchronous implementation is located in \Sync\ folder in the archive. In case you wish to use the synchronous version, minimum changes in your code is required, see below.
How to Migrate Your Code to New Async Interfaces
All interfaces and methods in v2 are made asynchronous and follow TAP naming convention. To migrate your code to async version you will need to add ‘Async’ suffix to all interfaces, methods and change the return type of methods. Follow the steps below:
- Change the reference to ITHit.WebDAV.Client.dll in your project. Remove the old reference and add the new one located under \Async\ folder.
- Replace WebDavSession class with WebDAVSessionAsync.
- Replace IResource interface with IFileAsync interface.
- Add 'Async' suffix to all interfaces. For example replace IFolder with IFolderAsync.
- Add 'Async' suffix to all methods. For example replace CreateFile method with CreateFileAsync.
Interfaces changes
V1 Interface, property or method | Replaced with in V2 |
---|---|
IResource | |
Stream IItemContent.GetReadStream(long,long,string,out bool) | |
Stream IItemContent.GetReadStream(long,long,DateTime,out bool) | |
IHierarchyItem.Comment | |
IHierarchyItem.CreatorDisplayName |