Class
ResourceStorageBase

Provides base functionality for managing resource storage with default folder creation capabilities.

Definition

Namespace:Telerik.WebReportDesigner.Services

Assembly:Telerik.WebReportDesigner.Services.dll

Syntax:

cs-api-definition
public abstract class ResourceStorageBase

Inheritance: objectResourceStorageBase

Derived Classes: ResourceStorage

Constructors

ResourceStorageBase(CreateFolderModel[])

Initializes a new instance of the ResourceStorageBase class with the specified default folders.

Declaration

cs-api-definition
public ResourceStorageBase(CreateFolderModel[] defaultFolders)

Parameters

defaultFolders

CreateFolderModel[]

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

cs-api-definition
protected readonly CreateFolderModel[] DefaultFoldersToCreate

Field Value

CreateFolderModel[]

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

cs-api-definition
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.

Methods

CreateDefaultFolder(CreateFolderModel)

Creates a default folder using the specified folder model in the derived storage implementation.

Declaration

cs-api-definition
protected abstract void CreateDefaultFolder(CreateFolderModel model)

Parameters

model

CreateFolderModel

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

cs-api-definition
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

cs-api-definition
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

cs-api-definition
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

cs-api-definition
protected void ValidateSavedResourceExtension(string resourceName)

Parameters

resourceName

string

The name of the resource file including its extension to validate.

Exceptions

InvalidResourceNameException

Thrown when the file extension is forbidden or invalid.

Remarks

Checks both the ForbiddenFileExtensions list and calls IsExtensionValid to ensure comprehensive validation.