November Happy Hour will be moved to Thursday December 5th.

Class BlobFactory

An factory class for working with binary large objects that can be handled by any registered provider

Inheritance
System.Object
BlobFactory
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: EPiServer.Framework.Blobs
Assembly: EPiServer.Framework.dll
Version: 9.12.2
Syntax
public class BlobFactory : IBlobFactory, IBlobProviderRegistry

Constructors

BlobFactory()

Declaration
public BlobFactory()

BlobFactory(String, IEnumerable<BlobProvider>)

Initialize a new instance of BlobFactory

Declaration
[Obsolete("Call Initialize instead")]
public BlobFactory(string defaultProvider, IEnumerable<BlobProvider> providers)
Parameters
Type Name Description
System.String defaultProvider

The default provider

System.Collections.Generic.IEnumerable<BlobProvider> providers

The list of supported providers

Properties

DefaultProvider

The default provider

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

Instance

The singleton instance of BlobFactory (redirects to ServiceLocator.Current)

Declaration
public static BlobFactory Instance { get; }
Property Value
Type Description
BlobFactory

Methods

CreateBlob(Uri, String)

Get a reference to a blob

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

The identifier of the container

System.String extension

The extension (such as ".png")

Returns
Type Description
Blob

A reference to a blob

Remarks

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

Delete(Uri)

Delete a blob or a container

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

The identifier of a blob or a blob container

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 virtual Blob GetBlob(Uri id)
Parameters
Type Name Description
System.Uri id

The identifier

Returns
Type Description
Blob

A reference to a blob

Remarks

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

GetProvider(Uri)

Get the provider for a blob authority

Declaration
public virtual BlobProvider GetProvider(Uri id)
Parameters
Type Name Description
System.Uri id

The blob identifier

Returns
Type Description
BlobProvider

A blob provider

Exceptions
Type Condition
System.ArgumentException

Thrown if no matching provider was found

Initialize(String, IEnumerable<BlobProvider>)

Initialize the BlobFactory

Declaration
public void Initialize(string defaultProvider, IEnumerable<BlobProvider> providers)
Parameters
Type Name Description
System.String defaultProvider

The default provider

System.Collections.Generic.IEnumerable<BlobProvider> providers

The list of supported providers

RegisterProvider(BlobProvider)

Register a blob provider

Declaration
public virtual void RegisterProvider(BlobProvider provider)
Parameters
Type Name Description
BlobProvider provider

The provider to register

Exceptions
Type Condition
System.ArgumentNullException

Thrown when provider or its name is null or empty

UnregisterProvider(String)

Unregister a blob provider

Declaration
public virtual bool UnregisterProvider(string name)
Parameters
Type Name Description
System.String name

The name of the provider (also used as authority in blob ID)

Returns
Type Description
System.Boolean

Returns true if the provider was found and removed

Remarks

Provider names are not case sensitive

Explicit Interface Implementations

IBlobProviderRegistry.AddProvider(BlobProvider)

Declaration
void IBlobProviderRegistry.AddProvider(BlobProvider provider)
Parameters
Type Name Description
BlobProvider provider

IBlobProviderRegistry.RemoveProvider(String)

Declaration
bool IBlobProviderRegistry.RemoveProvider(string name)
Parameters
Type Name Description
System.String name
Returns
Type Description
System.Boolean

Implements

Extension Methods