Chad
07/29/2024, 2:01 AMIFileSystem
to use managed identity based AzureBlobFileSystem
- however we've noticed that after a few days, media requests start failing. I am putting this down to the lifecycle of the objects being created. Does anyone know if the MediaFileSystem is basically a singleton for the life of the app?Chad
07/29/2024, 2:13 AMpublic static IUmbracoBuilder SetMediaFileSystem(
this IUmbracoBuilder builder,
Func<IServiceProvider, IFileSystem> filesystemFactory)
{
builder.Services.AddUnique(
provider =>
{
IFileSystem filesystem = filesystemFactory(provider);
// We need to use the Filesystems to create a shadow wrapper,
// because shadow wrapper requires the IsScoped delegate from the FileSystems.
// This is used by the scope provider when taking control of the filesystems.
FileSystems fileSystems = provider.GetRequiredService<FileSystems>();
IFileSystem shadow = fileSystems.CreateShadowWrapper(filesystem, "media");
return provider.CreateInstance<MediaFileManager>(shadow);
});
return builder;
}
Chad
07/29/2024, 2:13 AMChad
07/29/2024, 2:21 AMIMediaService
which is also a singleton...