Custom File System Provider

  • 2 minutes to read

ASPxFileManager allows you to implement your own custom file system provider.


To create your own custom provider, follow the steps below.

  1. Create your own provider class inheriting it from the base FileSystemProviderBase class or from one of its ancestors.

    public class LinqFileSystemProvider : FileSystemProviderBase {
  2. Provide implementation for the required virtual methods in your class. If you inherit from FileSystemProviderBase, the implementation of the following methods is essential.

    public class LinqFileSystemProvider : FileSystemProviderBase {
         public override IEnumerable<FileManagerFile> GetFiles(FileManagerFolder folder) {
              DbFileSystemItem dbFolderItem = FindDbFolderItem(folder);
                   from dbItem in DataContext.DbFileSystemItems
                   where !dbItem.IsFolder && dbItem.ParentId == dbFolderItem.Id
                   select new FileManagerFile(this, folder, dbItem.Name);
         public override IEnumerable<FileManagerFolder> GetFolders(FileManagerFolder parentFolder) {
              DbFileSystemItem dbFolderItem = FindDbFolderItem(parentFolder);
              from dbItem in FolderCache.Values
              where dbItem.IsFolder && dbItem.ParentId == dbFolderItem.Id
              select new FileManagerFolder(this, parentFolder, dbItem.Name);
         public override bool Exists(FileManagerFile file) {
              return FindDbFileItem(file) != null;
         public override bool Exists(FileManagerFolder folder) {
              return FindDbFolderItem(folder) != null;
         public override System.IO.Stream ReadFile(FileManagerFile file) {
              return new MemoryStream(FindDbFileItem(file).Data.ToArray());

    Note that you don't need to override all the methods if you descend from another predefined provider.

  3. Assign your provider class to ASPxFileManager by using either the ASPxFileManager.CustomFileSystemProvider or ASPxFileManager.CustomFileSystemProviderTypeName property.


    <dx:ASPxFileManager ID="ASPxFileManager1" runat="server" 
         CustomFileSystemProviderTypeName="LinqFileSystemProvider" >

    Programmatically (on the Page_Init event):

    public partial class FileManager_CustomFilterAPI : System.Web.UI.Page {
        protected void Page_Init(object sender, EventArgs e) {
            FileManager.CustomFileSystemProvider = new CustomFileSystemProvider(FileManager.Settings.RootFolder);
  4. Set the ASPxFileManager.ProviderType property to Custom to ASPxFileManager uses the custom provider.


How to: Implement a LINQ to SQL Based File System Provider

Online Blogs

ASP.NET File Manager - Create A Custom File System Provider

See Also