@@ -37,71 +37,32 @@ public class Startup
3737 /// </summary>
3838 /// <param name="services">The collection of service desscriptors.</param>
3939 public void ConfigureServices ( IServiceCollection services )
40- {
41- services . AddImageSharp ( )
42- . SetRequestParser < QueryCollectionRequestParser > ( )
43- . Configure < PhysicalFileSystemCacheOptions > ( options =>
44- {
45- options . CacheRootPath = null ;
46- options . CacheFolder = "is-cache" ;
47- options . CacheFolderDepth = 8 ;
48- } )
49- . SetCache < PhysicalFileSystemCache > ( )
50- . SetCacheKey < UriRelativeLowerInvariantCacheKey > ( )
51- . SetCacheHash < SHA256CacheHash > ( )
52- . Configure < PhysicalFileSystemProviderOptions > ( options =>
53- {
54- options . ProviderRootPath = null ;
55- } )
56- . AddProvider < PhysicalFileSystemProvider > ( )
57- . AddProcessor < ResizeWebProcessor > ( )
58- . AddProcessor < FormatWebProcessor > ( )
59- . AddProcessor < BackgroundColorWebProcessor > ( )
60- . AddProcessor < QualityWebProcessor > ( ) ;
61-
62- // Add the default service and options.
63- //
64- // services.AddImageSharp();
65-
66- // Or add the default service and custom options.
67- //
68- // this.ConfigureDefaultServicesAndCustomOptions(services);
69-
70- // Or we can fine-grain control adding the default options and configure all other services.
71- //
72- // this.ConfigureCustomServicesAndDefaultOptions(services);
73-
74- // Or we can fine-grain control adding custom options and configure all other services
75- // There are also factory methods for each builder that will allow building from configuration files.
76- //
77- // this.ConfigureCustomServicesAndCustomOptions(services);
78- }
40+ => services . AddImageSharp ( ) ; // Add the default service and options
7941
42+ // Or add the default service and custom options
8043 private void ConfigureDefaultServicesAndCustomOptions ( IServiceCollection services )
81- {
82- services . AddImageSharp ( options =>
44+ => services . AddImageSharp ( options =>
8345 {
8446 options . Configuration = Configuration . Default ;
8547 options . BrowserMaxAge = TimeSpan . FromDays ( 7 ) ;
8648 options . CacheMaxAge = TimeSpan . FromDays ( 365 ) ;
87- options . CacheHashLength = 8 ;
49+ options . CacheHashLength = 12 ;
8850 options . OnParseCommandsAsync = _ => Task . CompletedTask ;
8951 options . OnBeforeSaveAsync = _ => Task . CompletedTask ;
9052 options . OnProcessedAsync = _ => Task . CompletedTask ;
9153 options . OnPrepareResponseAsync = _ => Task . CompletedTask ;
9254 } ) ;
93- }
9455
56+ // Or we can fine-grain control adding the default options and configure all other services
9557 private void ConfigureCustomServicesAndDefaultOptions ( IServiceCollection services )
96- {
97- services . AddImageSharp ( )
98- . RemoveProcessor < FormatWebProcessor > ( )
99- . RemoveProcessor < BackgroundColorWebProcessor > ( ) ;
100- }
58+ => services . AddImageSharp ( )
59+ . RemoveProcessor < FormatWebProcessor > ( )
60+ . RemoveProcessor < BackgroundColorWebProcessor > ( ) ;
10161
62+ // Or we can fine-grain control adding custom options and configure all other services
63+ // There are also factory methods for each builder that will allow building from configuration files
10264 private void ConfigureCustomServicesAndCustomOptions ( IServiceCollection services )
103- {
104- services . AddImageSharp ( options =>
65+ => services . AddImageSharp ( options =>
10566 {
10667 options . Configuration = Configuration . Default ;
10768 options . BrowserMaxAge = TimeSpan . FromDays ( 7 ) ;
@@ -112,22 +73,22 @@ private void ConfigureCustomServicesAndCustomOptions(IServiceCollection services
11273 options . OnProcessedAsync = _ => Task . CompletedTask ;
11374 options . OnPrepareResponseAsync = _ => Task . CompletedTask ;
11475 } )
115- . SetRequestParser < QueryCollectionRequestParser > ( )
116- . Configure < PhysicalFileSystemCacheOptions > ( options =>
117- {
118- options . CacheFolder = "different-cache" ;
119- } )
120- . SetCache < PhysicalFileSystemCache > ( )
121- . SetCacheKey < UriRelativeLowerInvariantCacheKey > ( )
122- . SetCacheHash < SHA256CacheHash > ( )
123- . ClearProviders ( )
124- . AddProvider < PhysicalFileSystemProvider > ( )
125- . ClearProcessors ( )
126- . AddProcessor < ResizeWebProcessor > ( )
127- . AddProcessor < FormatWebProcessor > ( )
128- . AddProcessor < BackgroundColorWebProcessor > ( )
129- . AddProcessor < QualityWebProcessor > ( ) ;
130- }
76+ . SetRequestParser < QueryCollectionRequestParser > ( )
77+ . Configure < PhysicalFileSystemCacheOptions > ( options =>
78+ {
79+ options . CacheFolder = "different-cache" ;
80+ options . CacheFolderDepth = 6 ;
81+ } )
82+ . SetCache < PhysicalFileSystemCache > ( )
83+ . SetCacheKey < UriRelativeLowerInvariantCacheKey > ( )
84+ . SetCacheHash < SHA256CacheHash > ( )
85+ . ClearProviders ( )
86+ . AddProvider < PhysicalFileSystemProvider > ( )
87+ . ClearProcessors ( )
88+ . AddProcessor < ResizeWebProcessor > ( )
89+ . AddProcessor < FormatWebProcessor > ( )
90+ . AddProcessor < BackgroundColorWebProcessor > ( )
91+ . AddProcessor < QualityWebProcessor > ( ) ;
13192
13293 /// <summary>
13394 /// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
0 commit comments