Install Dav.AspNetCore.Server.Extensions.Npgsql via dotnet cli or through the package manager provided by your favorite IDE.
> dotnet add package Dav.AspNetCore.Server.Extensions.NpgsqlThis packages provides both: a property store, as well as a lock manager implementation. Based on what you want add either or both service registrations:
builder.Services.AddWebDav(davBuilder =>
{
davBuilder.AddLocalFiles(options =>
{
options.RootPath = "/tmp/";
});
davBuilder.AddNpgsqlLocks(options => options.ConnectionString = "Server=127.0.0.1;Port=5432;Database=webdav;User Id=root;Password=root;");
davBuilder.AddNpgsqlPropertyStore(options =>
{
// This would also allow not defined properties to be accepted
options.AcceptCustomProperties = true;
options.ConnectionString = "Server=127.0.0.1;Port=5432;Database=webdav;User Id=root;Password=root;";
});
});The schema needs to be created beforehand, there is no migration on app start.
CREATE TABLE dav_aspnetcore_server_resource_lock
(
Id text NOT NULL,
Uri text NOT NULL,
LockType INTEGER NOT NULL,
Owner text NOT NULL,
Recursive boolean NOT NULL,
Timeout bigint NOT NULL,
Issued bigint NOT NULL,
Depth INTEGER NOT NULL
);CREATE TABLE dav_aspnetcore_server_property
(
Uri text NOT NULL,
ElementName text NOT NULL,
ElementNamespace text NOT NULL,
ElementValue text NOT NULL
);