2018-07-23 09:21:55 +02:00
|
|
|
|
using Umbraco.Core.IO;
|
2018-07-20 09:49:05 +02:00
|
|
|
|
|
|
|
|
|
|
namespace Umbraco.Core.Composing.Composers
|
|
|
|
|
|
{
|
|
|
|
|
|
public static class FileSystemsComposer
|
|
|
|
|
|
{
|
2018-07-20 15:45:01 +02:00
|
|
|
|
public static IContainer ComposeFileSystems(this IContainer container)
|
2018-07-20 09:49:05 +02:00
|
|
|
|
{
|
|
|
|
|
|
// register FileSystems, which manages all filesystems
|
2018-07-20 15:45:01 +02:00
|
|
|
|
container.RegisterSingleton<FileSystems>();
|
2018-07-20 09:49:05 +02:00
|
|
|
|
|
|
|
|
|
|
// register IFileSystems, which gives access too all filesystems
|
2018-07-20 15:45:01 +02:00
|
|
|
|
container.RegisterSingleton<IFileSystems>(factory => factory.GetInstance<FileSystems>());
|
2018-07-20 09:49:05 +02:00
|
|
|
|
|
2018-09-02 22:56:55 +02:00
|
|
|
|
|
|
|
|
|
|
// fixme - review registering mediafilesystem. it seems to create cyclic dependencies for castle.
|
|
|
|
|
|
// let's try naming it so the default is overwritten...
|
|
|
|
|
|
|
2018-07-20 09:49:05 +02:00
|
|
|
|
// register MediaFileSystem, which can be injected directly
|
2018-07-23 09:21:55 +02:00
|
|
|
|
// note: the actual MediaFileSystem implementation is created by FileSystems directly,
|
|
|
|
|
|
// without being registered in the container - this just gives access to it
|
2018-09-02 22:56:55 +02:00
|
|
|
|
container.Register(f => f.GetInstance<FileSystems>().MediaFileSystem);
|
|
|
|
|
|
|
2018-07-20 09:49:05 +02:00
|
|
|
|
|
2018-07-20 15:45:01 +02:00
|
|
|
|
return container;
|
2018-07-20 09:49:05 +02:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|