skip navigation
  • Product Bundles

    DevCraft

    All Telerik .NET tools and Kendo UI JavaScript components in one package. Now enhanced with:

    • MCP Servers
    • Embedded Reporting
    • Document Processing Libraries
    • SSO Account Sign-in

    Web

    Kendo UI UI for Angular UI for Vue UI for jQuery KendoReact UI for Blazor UI for ASP.NET Core UI for ASP.NET MVC UI for ASP.NET AJAX

    Mobile

    UI for .NET MAUI

    Document Management

    Telerik Document Processing

    Desktop

    UI for .NET MAUI UI for WinUI UI for WinForms UI for WPF

    Reporting

    Telerik Reporting Telerik Report Server

    Testing & Mocking

    Test Studio Telerik JustMock

    CMS

    Sitefinity

    AI Productivity Tools

    MCP Servers

    UI/UX Tools

    ThemeBuilder Design System Kit Templates and Building Blocks

    Debugging

    Fiddler Fiddler Everywhere Fiddler Classic Fiddler Everywhere Reporter FiddlerCore

    Free Tools

    KendoReact Free VB.NET to C# Converter Testing Framework
    View all products
  • Overview
  • Demos
    • What's New
    • Roadmap
    • Release History
  • Support and Learning

    • Support and Learning Hub
    • First Steps
    • Docs
    • Demos
    • Virtual Classroom
    • Use Reports in Applications
    • System Requirements
    • Forums
    • Videos
    • Blogs
    • Submit a Ticket
    • FAQs
  • Pricing
  • Shopping cart
    • Account Overview
    • Your Licenses
    • Downloads
    • Support Center
    • Forum Profile
    • Payment Methods
    • Edit Profile
    • Log out
  • Login
  • Contact Us
  • Try now
Search all

Class FileDefinitionStorageBase

Abstract base class for file-based definition storage implementations in the WebReportDesigner system.

Inheritance
System.Object
ResourceStorageBase
ResourceStorage
FileDefinitionStorageBase
FileDefinitionStorage
FileSharedDataSourceStorage
FileTemplateDefinitionStorage
Inherited Members
ResourceStorage.RootFolderName
ResourceStorage.GetOrderedDefaultFoldersToCreate()
ResourceStorage.GetAllByExtension(String[])
ResourceStorage.GetFolderContentsAsync(String)
ResourceStorage.FolderHasContents(String)
ResourceStorage.GetFolderByName(String)
ResourceStorage.CreateFolderAsync(CreateFolderModel)
ResourceStorage.MoveFolder(MoveFolderModel)
ResourceStorage.RenameFolderAsync(RenameFolderModel)
ResourceStorage.DeleteFolderAsync(String)
ResourceStorage.FolderNameExists(String)
ResourceStorage.FolderExists(String)
ResourceStorage.GetAsync(String)
ResourceStorage.GetByUri(String)
ResourceStorage.ResourceNameExists(String)
ResourceStorage.ResourceExists(String)
ResourceStorage.GetFile(String)
ResourceStorage.GetModelByName(String)
ResourceStorage.GetModelCore<T>(String)
ResourceStorage.Save(String, Byte[])
ResourceStorage.SaveAsync(SaveResourceModel, Byte[])
ResourceStorage.SaveAsync(SaveResourceModel, Byte[], Boolean)
ResourceStorage.SaveCore<T>(SaveResourceModel, Byte[], Boolean)
ResourceStorage.Overwrite(OverwriteResourceModel, Byte[])
ResourceStorage.OverwriteCore<T>(OverwriteResourceModel, Byte[])
ResourceStorage.RenameAsync(RenameResourceModel)
ResourceStorage.RenameCore<T>(RenameResourceModel)
ResourceStorage.Move(MoveResourceModel)
ResourceStorage.MoveCore<T>(MoveResourceModel)
ResourceStorage.Search(SearchResourcesModel)
ResourceStorage.CreateDirectory(String[])
ResourceStorage.EnsureDefaultFolders()
ResourceStorage.CreateDefaultFolder(CreateFolderModel)
ResourceStorage.BaseDir
ResourceStorageBase.defaultFolders
ResourceStorageBase.DefaultFoldersToCreate
ResourceStorageBase.ValidateSavedResourceExtension(String)
ResourceStorageBase.IsExtensionValid(String)
Namespace: Telerik.WebReportDesigner.Services
Assembly: Telerik.WebReportDesigner.Services.dll

Syntax

public abstract class FileDefinitionStorageBase : ResourceStorage, IResourceStorage, IAssetsStorage, IHasBaseDir
Remarks

Provides common functionality for storing and managing definition files (reports, shared data sources) with file system operations, validation, and exception handling. Derived classes implement specific definition types and validation rules.

Constructors

FileDefinitionStorageBase(String, String[])

Creates an instance of FileDefinitionStorageBase class.

Declaration
public FileDefinitionStorageBase(string baseDir, string[] definitionFolders)
Parameters
System.String baseDir

The base directory where definition files are stored.

System.String[] definitionFolders

The collection of definition folders to be created by default.

Remarks

Creates a definition storage with the specified base directory and default folder structure, using no excluded folders.

FileDefinitionStorageBase(String, String[], String[])

Creates an instance of FileDefinitionStorageBase class.

Declaration
public FileDefinitionStorageBase(string baseDir, string[] definitionFolders, string[] excludedFolders)
Parameters
System.String baseDir

The base directory where definition files are stored.

System.String[] definitionFolders

The collection of definition folders to be created by default.

System.String[] excludedFolders

Relative folder paths to be excluded when retrieving folder contents. Wildcards are not supported.

Remarks

Creates a definition storage with specified base directory, default folders, and the ability to exclude specific folders from operations.

Properties

FileExtensions

Gets the array of allowed file extensions for this definition storage.

Declaration
protected abstract string[] FileExtensions { get; }
Property Value
System.String[]

Remarks

Implemented by derived classes to specify which file extensions are valid for the particular definition type being managed.

Methods

DeleteAsync(String)

Deletes a definition file by its URI.

Declaration
public override Task DeleteAsync(string uri)
Parameters
System.String uri

The unique resource identifier (URI) of the definition.

Returns
System.Threading.Tasks.Task

Overrides
ResourceStorage.DeleteAsync(String)
Remarks

Validates the definition identifier before deletion and suppresses ResourceNotFoundException for non-existing definitions, allowing idempotent delete operations.

GetByUri<TDefinitionNotFoundException>(String)

Retrieves the raw bytes from the specified definition resource.

Declaration
protected virtual byte[] GetByUri<TDefinitionNotFoundException>(string uri)
    where TDefinitionNotFoundException : Exception
Parameters
System.String uri

The unique resource identifier of the definition.

Returns
System.Byte[]

The definition content as a byte array.

Type Parameters
TDefinitionNotFoundException

The specific exception type to throw when the definition is not found.

Remarks

Validates the definition identifier and wraps resource exceptions in definition-specific exceptions for consistent error handling.

GetFolderAsync(String)

Retrieves the folder model at the specified URI or returns null if not found.

Declaration
public override Task<ResourceFolderModel> GetFolderAsync(string uri)
Parameters
System.String uri

The unique resource identifier of the folder.

Returns
System.Threading.Tasks.Task<ResourceFolderModel>

The ResourceFolderModel or null if the folder is not found.

Overrides
ResourceStorage.GetFolderAsync(String)
Remarks

Provides null-safe folder retrieval by catching ResourceFolderNotFoundException and returning null instead of propagating the exception.

GetFolderContents(String, String[])

Lists all definition resource files found in the given uri.

Declaration
public override IEnumerable<ResourceModelBase> GetFolderContents(string uri, string[] searchPattern)
Parameters
System.String uri

The unique resource identifier(URI) of the folder. null or empty string represents the root directory

System.String[] searchPattern

The file search patterns used when retrieving definition resources.

Returns
System.Collections.Generic.IEnumerable<ResourceModelBase>

A list of all files and subfolders found in the provided folder URI as an enumerable of ResourceModelBase

Overrides
ResourceStorage.GetFolderContents(String, String[])
Remarks

Overrides the base implementation to use the storage-specific file extensions instead of the provided search pattern, ensuring only valid definition files are returned.

GetModelAsync(String)

Retrieves the resource model at the specified URI or returns null if not found.

Declaration
public override Task<ResourceFileModel> GetModelAsync(string uri)
Parameters
System.String uri

The unique resource identifier of the resource.

Returns
System.Threading.Tasks.Task<ResourceFileModel>

The ResourceFileModel or null if the resource is not found.

Overrides
ResourceStorage.GetModelAsync(String)
Remarks

Provides null-safe resource retrieval by catching ResourceNotFoundException and returning null instead of propagating the exception.

RenameAsync<TInvalidDefinitionNameException>(RenameResourceModel)

Renames a definition file.

Declaration
protected virtual Task<ResourceFileModel> RenameAsync<TInvalidDefinitionNameException>(RenameResourceModel model)
    where TInvalidDefinitionNameException : Exception
Parameters
RenameResourceModel model

The model containing rename operation data.

Returns
System.Threading.Tasks.Task<ResourceFileModel>

A task representing the asynchronous rename operation with the updated resource model.

Type Parameters
TInvalidDefinitionNameException

The specific exception type to throw for invalid definition names.

Remarks

Wraps invalid resource name exceptions in definition-specific exceptions for consistent error handling across different definition types.

Save(SaveResourceModel, Byte[], Boolean, Boolean)

Creates a new or overwrites an existing definition file with the provided content.

Declaration
public ResourceFileModel Save(SaveResourceModel model, byte[] resource, bool overwrite, bool forcePath)
Parameters
SaveResourceModel model

The model containing save operation data.

System.Byte[] resource

The definition content as a byte array.

System.Boolean overwrite

Whether to overwrite existing files.

System.Boolean forcePath

Whether to create the directory path if it doesn't exist.

Returns
ResourceFileModel

The ResourceFileModel of the saved definition.

Remarks

Validates the definition identifier and handles both new file creation and existing file overwrite scenarios with proper path management.

SaveAsync<TDefinitionNotFoundException>(SaveResourceModel, Byte[])

Saves a definition file to the storage system.

Declaration
protected virtual Task<ResourceFileModel> SaveAsync<TDefinitionNotFoundException>(SaveResourceModel model, byte[] resource)
    where TDefinitionNotFoundException : Exception
Parameters
SaveResourceModel model

The model containing save operation data.

System.Byte[] resource

The definition content as a byte array.

Returns
System.Threading.Tasks.Task<ResourceFileModel>

A task representing the asynchronous save operation with the saved resource model.

Type Parameters
TDefinitionNotFoundException

The specific exception type to throw when the target location is not found.

Remarks

Wraps resource not found exceptions in definition-specific exceptions for consistent error handling during save operations.

ValidateDefinitionId(String)

Validates the provided definition identifier according to the storage's rules.

Declaration
protected abstract void ValidateDefinitionId(string definitionId)
Parameters
System.String definitionId

The definition identifier to validate.

Remarks

Implemented by derived classes to enforce specific naming conventions and validation rules for definition identifiers.

WrapException<TResult, TDefinitionException, TResourceException>(Func<TResult>)

Executes a callback and wraps resource exceptions in definition-specific exceptions.

Declaration
protected TResult WrapException<TResult, TDefinitionException, TResourceException>(Func<TResult> callback)
    where TDefinitionException : Exception where TResourceException : Exception
Parameters
System.Func<TResult> callback

The operation to execute.

Returns
TResult

The result of the callback operation.

Type Parameters
TResult

The return type of the callback.

TDefinitionException

The definition-specific exception type to throw.

TResourceException

The resource exception type to catch and wrap.

Remarks

Provides consistent exception handling by converting generic resource exceptions into definition-specific exceptions with preserved inner exception details.

Getting Started
  • Install Now
  • Online Demos
Support Resources
  • Documentation
  • Knowledge Base
  • Videos
  • Reporting Samples Repository
  • Reporting Release History
Community
  • Forums
  • Blogs
  • Reporting Feedback Portal

Copyright © 2018 Progress Software Corporation and/or its subsidiaries or affiliates.
All Rights Reserved.

Progress, Telerik, and certain product names used herein are trademarks or registered trademarks of Progress Software Corporation and/or one of its subsidiaries or affiliates in the U.S. and/or other countries. See Trademarks for appropriate markings.