/
dundich
/
sa
Обзор
Документация
Войти
/
dundich
/
sa
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
src/Sa.HybridFileStorage.FileSystem/Setup.cs
20 строк
791 B
dundich
added hyrbid file storages (#3)
24 апр 2025, 14:31
Не верифицирован
24 апр 2025, 14:31
0fecc3c
Код
Авторство
О чём код?
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection.Extensions; using Sa.HybridFileStorage.Domain; using Sa.Timing.Providers; namespace Sa.HybridFileStorage.FileSystem; public static class Setup { public static IServiceCollection AddFileSystemFileStorage(this IServiceCollection services, FileSystemStorageOptions options) { services.AddSaInfrastructure(); services.TryAddKeyedSingleton<FileSystemStorageOptions>(options); services.TryAddKeyedSingleton<FileSystemStorage>(options, (sp, o) => new FileSystemStorage(options, sp.GetRequiredService<ICurrentTimeProvider>())); services.AddSingleton<IFileStorage>(sp => sp.GetRequiredKeyedService<FileSystemStorage>(options)); return services; } }