Class FileBlobProvider

A BlobProvider implementation that serves blobs from files in a file system.

Inheritance
System.Object
FileBlobProvider
Namespace: EPiServer.Framework.Blobs
Assembly: EPiServer.Framework.dll
Version: 12.0.3
Syntax
public class FileBlobProvider : BlobProvider

Constructors

FileBlobProvider()

Create a new FileBlobProvider and sets the repository path to the [appDataPath]\blobs directory.

Declaration
public FileBlobProvider()

FileBlobProvider(IPhysicalPathResolver)

Creates a new instance of the FileBlobProvider class.

Declaration
public FileBlobProvider(IPhysicalPathResolver physicalPathResolver)
Parameters
Type Name Description
IPhysicalPathResolver physicalPathResolver

FileBlobProvider(IPhysicalPathResolver, FileBlobProviderOptions)

Creates a new instance of the FileBlobProvider class.

Declaration
public FileBlobProvider(IPhysicalPathResolver physicalPathResolver, FileBlobProviderOptions options)
Parameters
Type Name Description
IPhysicalPathResolver physicalPathResolver

The physical path resolver

FileBlobProviderOptions options

The options

FileBlobProvider(String)

Create a new FileBlobProvider with a specific repository path.

Declaration
public FileBlobProvider(string path)
Parameters
Type Name Description
System.String path

The path to the location where file blobs are stored.

Properties

KeepStructure

Set to true to keep created folder structure even if folders are empty

Declaration
public bool KeepStructure { get; set; }
Property Value
Type Description
System.Boolean
Remarks

Some hosting environments (like ASP.NET) keep track of structure under application and might restart application due to changes

Default value is false

Path

Path to blob repository

Declaration
public string Path { get; set; }
Property Value
Type Description
System.String

Methods

CreateBlob(Uri, String)

Create a reference to a new blob

Declaration
public override Blob CreateBlob(Uri id, string extension)
Parameters
Type Name Description
System.Uri id

The identifier of the container

System.String extension

The extention (such as .png)

Returns
Type Description
Blob

A reference to a blob

Overrides

Delete(Uri)

Delete a blob or a container

Declaration
public override void Delete(Uri id)
Parameters
Type Name Description
System.Uri id

The identifier of a blob or a blob container

Overrides
Remarks

The Host part of the identifier is the container and the path is the file/blob that is being deleted. If the file is missing it is assumed that the container is being deleted.

GetBlob(Uri)

Get a reference to a blob

Declaration
public override Blob GetBlob(Uri id)
Parameters
Type Name Description
System.Uri id

The identifier

Returns
Type Description
Blob

A reference to a blob

Overrides
Remarks

This method will always return a reference even though the actual blob does not exists

Initialize(String)

Initialize the FileBlobProvider with the provided name and the default options.

Declaration
public void Initialize(string name)
Parameters
Type Name Description
System.String name

Name of the provider

Initialize(String, FileBlobProviderOptions)

Initialize the FileBlobProvider

Declaration
public void Initialize(string name, FileBlobProviderOptions options)
Parameters
Type Name Description
System.String name

Name of the provider

FileBlobProviderOptions options

The provider configuration options.

Initialize(String, NameValueCollection)

Initialize the FileBlobProvider

Declaration
public override void Initialize(string name, NameValueCollection config)
Parameters
Type Name Description
System.String name

Name of the provider

System.Collections.Specialized.NameValueCollection config

provider settings

Overrides
Remarks

This method is mainly used by when initialized from the web.config. Use other Initialize method for a strongly typed version

Extension Methods