Пример #1
0
        public static IServiceCollection AddJsonFileStorage <T>(this IServiceCollection services, StoragePathOptions options) where T : class
        {
            services.AddScoped <IStoragePathOptions, StoragePathOptions>(x => options);
            services.AddScoped <IStoragePathResolver, DefaultStoragePathResolver>();
            services.AddScoped <IFileContentSerializer <T>, JsonSerializer <T> >();
            services.AddScoped <IFileStorageContext <T>, FileStorageContext <T> >();

            return(services);
        }
Пример #2
0
        public static IServiceCollection AddMarkdownFileStorage(this IServiceCollection services, StoragePathOptions options)
        {
            services.AddScoped <IStoragePathOptions, StoragePathOptions>(x => options);
            services.AddScoped <IStoragePathResolver, DefaultStoragePathResolver>();
            services.AddScoped <IFileContentSerializer <string>, MarkdownSerializer <string> >();
            services.AddScoped <IFileStorageContext <string>, FileStorageContext <string> >();

            return(services);
        }