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