using Umbraco.Core.Composing; using Umbraco.Core.IO; namespace Umbraco.Core { /// /// Provides extension methods to the class. /// public static partial class CompositionExtensions { /// /// Registers a filesystem. /// /// The type of the filesystem. /// The implementing type. /// The composition. /// The register. public static void RegisterFileSystem(this Composition composition) where TImplementing : FileSystemWrapper, TFileSystem where TFileSystem : class { composition.RegisterUnique(factory => { var fileSystems = factory.GetInstance(); var supporting = factory.GetInstance(); return fileSystems.GetFileSystem(supporting.For()); }); } /// /// Registers a filesystem. /// /// The type of the filesystem. /// The composition. /// The register. public static void RegisterFileSystem(this Composition composition) where TFileSystem : FileSystemWrapper { composition.RegisterUnique(factory => { var fileSystems = factory.GetInstance(); var supporting = factory.GetInstance(); return fileSystems.GetFileSystem(supporting.For()); }); } } }