[ASP.NET Core 3框架揭秘] 文件系统[3]:物理文件系统

ASP.NET Core应用中使用得最多的还是具体的物理文件,比如配置文件、View文件以及作为Web资源的静态文件。物理文件系统由定义在NuGet包“Microsoft.Extensions.FileProviders.Physical”中的PhysicalFileProvider来构建。我们知道System.IO命名空间下定义了一整套针操作物理目录和文件的API,实际上PhysicalFileProvider最终也是通过调用这些API来完成相关的IO操作。

public class PhysicalFileProvider : IFileProvider, IDisposable { public PhysicalFileProvider(string root); public IFileInfo GetFileInfo(string subpath); public IDirectoryContents GetDirectoryContents(string subpath); public IChangeToken Watch(string filter); public void Dispose(); }

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/wspwzp.html