Total Downloads

2,596,730

Total Files

9,206

Latest Update

10

How to use File Providers in ASP.Net Core

Posted September 24, 2018 | Windows


File Providers in ASP.Net Core provide a layer of abstraction on the file system, allowing us to easily obtain file and directory information, watch for changes, and of course access physical files. This article examines how we can work with file providers in ASP.Net Core.

File Provider abstractions

The file providers implement the IFileProvider interface. There are three implementations of IFileProvider: Physical, Embedded, and Composite. The IFileProvider is the main interface that exposes the necessary methods to retrieve file information (using the IFileInfo interface) and directory information (using the IDirectoryContents interface). To set up change notifications, you can take advantage of the IChangeToken interface.

Below I’ve listed each file provider class and its purpose. Each of these providers implements the IFileProvider interface.

  • PhysicalFileProvider—used to provide access to the physical file system
  • EmbeddedFileProvider—used to access files inside the assemblies
  • CompositeFileProvider—used to provide combined access; i.e., a single interface used to work with files from multiple providers

Use PhysicalFileProvider in ASP.Net Core



Source link

')
ankara escort çankaya escort çankaya escort escort bayan çankaya istanbul rus escort eryaman escort ankara escort kızılay escort istanbul escort ankara escort ankara escort escort ankara istanbul rus Escort atasehir Escort beylikduzu Escort Ankara Escort malatya Escort kuşadası Escort gaziantep Escort izmir Escort