Skip to main content

PhysicalFileSystemProvider.GetItems(FileSystemLoadItemOptions) Method

Gets file system items.

Namespace: DevExtreme.AspNet.Mvc.FileManagement

Assembly: DevExtreme.AspNet.Core.dll

Declaration

public virtual IEnumerable<FileSystemItem> GetItems(
    FileSystemLoadItemOptions options
)

Parameters

Name Type Description
options FileSystemLoadItemOptions

Options related to the operation.

Returns

Type Description
IEnumerable<FileSystemItem>

A collection of file system items.

Remarks

The following example illustrates how to overwrite the GetItems method.

Refer to the Binding to Entity Framework ORM online demo to get the whole example code.

public IEnumerable<FileSystemItem> GetItems(FileSystemLoadItemOptions options) {
    int parentId = ParseKey(options.Directory.Key);
    var fileItems = GetDirectoryContents(parentId);
    var hasSubDirectoriesInfo = GetHasSubDirectoriesInfo(fileItems);

    var clientItemList = new List<FileSystemItem>();
    foreach(var item in fileItems) {
        var clientItem = new FileSystemItem {
            Key = item.Id.ToString(),
            Name = item.Name,
            IsDirectory = item.IsDirectory,
            DateModified = item.Modified
        };
        if(item.IsDirectory) {
            clientItem.HasSubDirectories = hasSubDirectoriesInfo.ContainsKey(item.Id) && hasSubDirectoriesInfo[item.Id];
        }
        //...
    }
    return clientItemList;
}
See Also