ResourceStorageBase
Provides base functionality for managing resource storage with default folder creation capabilities.
Definition
Namespace:Telerik.WebReportDesigner.Services
Assembly:Telerik.WebReportDesigner.Services.dll
Syntax:
public abstract class ResourceStorageBase
Inheritance: objectResourceStorageBase
Derived Classes:
Constructors
Initializes a new instance of the ResourceStorageBase class with the specified default folders.
public ResourceStorageBase(CreateFolderModel[] defaultFolders)
The array of folder models that will be created during initialization.
The provided folders will be created automatically when the storage is initialized.
Fields
Gets the predefined set of default folders that are created during resource storage initialization.
protected static readonly CreateFolderModel[] defaultFolders
Contains Data, Images, and Styles folders that are automatically created to organize different types of report resources.
Gets the collection of default folders that will be created during storage initialization.
protected readonly CreateFolderModel[] DefaultFoldersToCreate
This property is set during construction and determines which folders are automatically created.
Methods
Creates a default folder using the specified folder model in the derived storage implementation.
protected abstract void CreateDefaultFolder(CreateFolderModel model)
The folder model containing the name and parent URI for the folder to create.
This abstract method must be implemented by derived classes to handle the actual folder creation logic for their specific storage mechanism.
Creates the default folders by iterating through the configured folder collection in the correct order.
protected virtual void EnsureDefaultFolders()
Logs folder creation attempts and silently ignores ResourceFolderAlreadyExistsException to handle cases where folders already exist.
GetOrderedDefaultFoldersToCreate()
IEnumerable<CreateFolderModel>
Gets the default folders ordered to ensure parent folders are created before child folders.
protected virtual IEnumerable<CreateFolderModel> GetOrderedDefaultFoldersToCreate()
IEnumerable<CreateFolderModel>
An enumerable collection of CreateFolderModel objects sorted by ParentUri to maintain proper creation hierarchy.
Orders folders by ParentUri to guarantee that parent directories exist before attempting to create nested folders.
Determines whether the specified file extension is valid for resource uploads.
protected virtual bool IsExtensionValid(string resourceExtension)
The file extension to validate (without the leading dot).
Returns:bool
True if the extension is valid; otherwise, false.
The base implementation returns true for all extensions, allowing derived classes to override with custom validation logic.
Validates that the specified resource name has an allowed file extension for security purposes.
protected void ValidateSavedResourceExtension(string resourceName)
The name of the resource file including its extension to validate.
Exceptions:Thrown when the file extension is forbidden or invalid.
Checks both the ForbiddenFileExtensions list and calls IsExtensionValid to ensure comprehensive validation.