Abstract base class for file-based definition storage implementations in the WebReportDesigner system.
Definition
Namespace:Telerik.WebReportDesigner.Services
Assembly:Telerik.WebReportDesigner.Services.dll
Syntax:
public abstract class FileDefinitionStorageBase : ResourceStorage, IResourceStorage, IAssetsStorage
Inheritance: objectResourceStorageBaseResourceStorageFileDefinitionStorageBase
Derived Classes:
Implements:
Inherited Members
Constructors
Creates an instance of FileDefinitionStorageBase class.
public FileDefinitionStorageBase(string baseDir, string[] definitionFolders, string[] excludedFolders)
The base directory where definition files are stored.
definitionFoldersstring[]The collection of definition folders to be created by default.
excludedFoldersstring[]Relative folder paths to be excluded when retrieving folder contents. Wildcards are not supported.
Creates a definition storage with specified base directory, default folders, and the ability to exclude specific folders from operations.
Creates an instance of FileDefinitionStorageBase class.
public FileDefinitionStorageBase(string baseDir, string[] definitionFolders)
The base directory where definition files are stored.
definitionFoldersstring[]The collection of definition folders to be created by default.
Creates a definition storage with the specified base directory and default folder structure, using no excluded folders.
Properties
FileExtensions
string[]
Gets the array of allowed file extensions for this definition storage.
protected abstract string[] FileExtensions { get; }
Implemented by derived classes to specify which file extensions are valid for the particular definition type being managed.
Methods
Deletes a definition file by its URI.
public override Task DeleteAsync(string uri)
The unique resource identifier (URI) of the definition.
Returns:Task
Overrides:
Validates the definition identifier before deletion and suppresses ResourceNotFoundException for non-existing definitions, allowing idempotent delete operations.
Retrieves the raw bytes from the specified definition resource.
protected virtual byte[] GetByUri<TDefinitionNotFoundException>(string uri) where TDefinitionNotFoundException : Exception
The unique resource identifier of the definition.
Returns:byte[]
The definition content as a byte array.
Validates the definition identifier and wraps resource exceptions in definition-specific exceptions for consistent error handling.
Retrieves the folder model at the specified URI or returns null if not found.
public override Task<ResourceFolderModel> GetFolderAsync(string uri)
The unique resource identifier of the folder.
Returns:Task<ResourceFolderModel>
The ResourceFolderModel or null if the folder is not found.
Overrides:
Provides null-safe folder retrieval by catching ResourceFolderNotFoundException and returning null instead of propagating the exception.
GetFolderContents(string, string[])
IEnumerable<ResourceModelBase>
Lists all definition resource files found in the given uri.
public override IEnumerable<ResourceModelBase> GetFolderContents(string uri, string[] searchPattern)
The unique resource identifier(URI) of the folder. null or empty string represents the root directory
searchPatternstring[]The file search patterns used when retrieving definition resources.
Returns:IEnumerable<ResourceModelBase>
A list of all files and subfolders found in the provided folder URI as an enumerable of ResourceModelBase
Overrides:
Overrides the base implementation to use the storage-specific file extensions instead of the provided search pattern, ensuring only valid definition files are returned.
Retrieves the resource model at the specified URI or returns null if not found.
public override Task<ResourceFileModel> GetModelAsync(string uri)
The unique resource identifier of the resource.
Returns:Task<ResourceFileModel>
The ResourceFileModel or null if the resource is not found.
Overrides:
Provides null-safe resource retrieval by catching ResourceNotFoundException and returning null instead of propagating the exception.
Renames a definition file.
protected virtual Task<ResourceFileModel> RenameAsync<TInvalidDefinitionNameException>(RenameResourceModel model) where TInvalidDefinitionNameException : Exception
The model containing rename operation data.
Returns:Task<ResourceFileModel>
A task representing the asynchronous rename operation with the updated resource model.
Wraps invalid resource name exceptions in definition-specific exceptions for consistent error handling across different definition types.
Creates a new or overwrites an existing definition file with the provided content.
public ResourceFileModel Save(SaveResourceModel model, byte[] resource, bool overwrite, bool forcePath)
The model containing save operation data.
resourcebyte[]The definition content as a byte array.
overwriteboolWhether to overwrite existing files.
forcePathboolWhether to create the directory path if it doesn't exist.
Returns:The ResourceFileModel of the saved definition.
Validates the definition identifier and handles both new file creation and existing file overwrite scenarios with proper path management.
Saves a definition file to the storage system.
protected virtual Task<ResourceFileModel> SaveAsync<TDefinitionNotFoundException>(SaveResourceModel model, byte[] resource) where TDefinitionNotFoundException : Exception
The model containing save operation data.
resourcebyte[]The definition content as a byte array.
Returns:Task<ResourceFileModel>
A task representing the asynchronous save operation with the saved resource model.
Wraps resource not found exceptions in definition-specific exceptions for consistent error handling during save operations.
Validates the provided definition identifier according to the storage's rules.
protected abstract void ValidateDefinitionId(string definitionId)
The definition identifier to validate.
Implemented by derived classes to enforce specific naming conventions and validation rules for definition identifiers.
Executes a callback and wraps resource exceptions in definition-specific exceptions.
protected TResult WrapException<TResult, TDefinitionException, TResourceException>(Func<TResult> callback) where TDefinitionException : Exception where TResourceException : Exception
The operation to execute.
Returns:TResult
The result of the callback operation.
Provides consistent exception handling by converting generic resource exceptions into definition-specific exceptions with preserved inner exception details.