CompressedStaticFiles icon indicating copy to clipboard operation
CompressedStaticFiles copied to clipboard

Added Ability to serve Static Files from Alternate FileProviders

Open aloksharma1 opened this issue 3 years ago • 3 comments

Added Ability to serve Static Files from Alternate FileProviders like virtual or embedded sources

aloksharma1 avatar May 14 '22 12:05 aloksharma1

@aloksharma1 Thanks for the pull request, to be honest I'm not 100% sure I like the string array solution.. Is there no way to solve this in a more elegant way?

AnderssonPeter avatar May 16 '22 08:05 AnderssonPeter

@aloksharma1 Thanks for the pull request, to be honest I'm not 100% sure I like the string array solution.. Is there no way to solve this in a more elegant way?

i tried using IFIleProviders themselves as collection hashset unfortunately all those classes are marked as internal in .net & arrays are faster in this case. we can simply use physicalpath==null as check itself, but this raise future issues as we don't have all use cases for different file providers (Some users/libraries also come up with custom FileProvider implementation which will be unknown if we use default collection internally to match things ) , so passing the matching file provider array is best case to make things robust. Also, performance wise a very small array wont take more then few ns & will hardly ever hit 1ms mark (so here over optimization is not needed). I did marked the method for aggressive in-lining so compiler can take care of that as possible.

aloksharma1 avatar May 16 '22 09:05 aloksharma1

It's not that i don't think this will be performant, it's just that I think it's clunky as a solution, currently I don't have the time to find a better one, but i somewhat unsure if I will merge this code in it's current state.

AnderssonPeter avatar May 17 '22 20:05 AnderssonPeter

will not be merged in it's current form.

AnderssonPeter avatar Aug 11 '22 14:08 AnderssonPeter