Class ResourceStorageBase
Provides base functionality for managing resource storage with default folder creation capabilities.
Inheritance
Namespace: Telerik.WebReportDesigner.Services
Assembly: Telerik.WebReportDesigner.Services.dll
Syntax
public abstract class ResourceStorageBase
Remarks
Derived classes should implement specific storage mechanisms while inheriting default folder management and security features.
Constructors
ResourceStorageBase(CreateFolderModel[])
Initializes a new instance of the ResourceStorageBase class with the specified default folders.
Declaration
public ResourceStorageBase(CreateFolderModel[] defaultFolders)
Parameters
|
CreateFolderModel[]
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
defaultFolders
Gets the predefined set of default folders that are created during resource storage initialization.
Declaration
protected static readonly CreateFolderModel[] defaultFolders
Field Value
|
CreateFolderModel[]
|
Remarks
Contains Data, Images, and Styles folders that are automatically created to organize different types of report resources.
DefaultFoldersToCreate
Gets the collection of default folders that will be created during storage initialization.
Declaration
protected readonly CreateFolderModel[] DefaultFoldersToCreate
Field Value
|
CreateFolderModel[]
|
Remarks
This property is set during construction and determines which folders are automatically created.
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
|
CreateFolderModel
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
|
System.Collections.Generic.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
|
System.String
resourceExtension
The file extension to validate (without the leading dot). |
Returns
|
System.Boolean
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
|
System.String
resourceName
The name of the resource file including its extension to validate. |
Remarks
Checks both the ForbiddenFileExtensions list and calls IsExtensionValid to ensure comprehensive validation.
Exceptions
|
InvalidResourceNameException
Thrown when the file extension is forbidden or invalid. |