You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Nov 6, 2018. It is now read-only.
If I have files from multiple sources(ex: physical and embedded), is it expected to write my own composite file provider?
My scenario - I was trying to see how a fix for this issue would be.
Example:
publicclassCompositeFileProvider:IFileProvider{privatereadonlyIEnumerable<IFileProvider>_fileProviders;publicCompositeFileProvider(IEnumerable<IFileProvider>fileProviders){_fileProviders=fileProviders;}publicIDirectoryContentsGetDirectoryContents(stringsubpath){foreach(varproviderin_fileProviders){varcontents=provider.GetDirectoryContents(subpath);if(contents!=null&&contents.Exists){returncontents;}}returnnewNotFoundDirectoryContents();}publicIFileInfoGetFileInfo(stringsubpath){foreach(varproviderin_fileProviders){varfileInfo=provider.GetFileInfo(subpath);if(fileInfo!=null&&fileInfo.Exists){returnfileInfo;}}returnnewNotFoundFileInfo(subpath);}publicIExpirationTriggerWatch(stringfilter){foreach(varproviderin_fileProviders){vartrigger=provider.Watch(filter);if(trigger!=null){returntrigger;}}returnNoopTrigger.Singleton;}}// copied from FileSystem repoclassNotFoundFileInfo:IFileInfo{privatereadonlystring_name;publicNotFoundFileInfo(stringname){_name=name;}publicboolExists{get{returnfalse;}}publicboolIsDirectory{get{returnfalse;}}publicDateTimeOffsetLastModified{get{returnDateTimeOffset.MinValue;}}publiclongLength{get{return-1;}}publicstringName{get{return_name;}}publicstringPhysicalPath{get{returnnull;}}publicStreamCreateReadStream(){thrownewFileNotFoundException(string.Format("The file {0} does not exist.",Name));}}classNotFoundDirectoryContents:IDirectoryContents{publicboolExists{get{returnfalse;}}publicIEnumerator<IFileInfo>GetEnumerator(){returnEnumerable.Empty<IFileInfo>().GetEnumerator();}IEnumeratorIEnumerable.GetEnumerator(){returnGetEnumerator();}}classNoopTrigger:IExpirationTrigger{publicstaticNoopTriggerSingleton{get;}=newNoopTrigger();privateNoopTrigger(){}publicboolActiveExpirationCallbacks{get{returnfalse;}}publicboolIsExpired{get{returnfalse;}}publicIDisposableRegisterExpirationCallback(Action<object>callback,objectstate){thrownewInvalidOperationException("Trigger does not support registering change notifications.");}}
The text was updated successfully, but these errors were encountered:
I am not sure if its intentional, but I see in few places where we accept a single file provider instance.
https://github.com/aspnet/StaticFiles/blob/dev/src/Microsoft.AspNet.StaticFiles/Infrastructure/SharedOptions.cs#L44
https://github.com/aspnet/Mvc/blob/dev/src/Microsoft.AspNet.Mvc.Razor/RazorViewEngineOptions.cs#L31
If I have files from multiple sources(ex: physical and embedded), is it expected to write my own composite file provider?
My scenario - I was trying to see how a fix for this issue would be.
Example:
The text was updated successfully, but these errors were encountered: