public static IDependencyEngine Setup(IDependencyEngine dependencyEngine)
        {
            const DependencyLifeStyle applicationLifeStyle = DependencyLifeStyle.Singleton;
            const DependencyLifeStyle controllerLifeStyle = DependencyLifeStyle.Transient;
            const DependencyLifeStyle photoServiceLifeStyle = DependencyLifeStyle.Transient;
            const DependencyLifeStyle optOutServiceLifeStyle = DependencyLifeStyle.Transient;
            const DependencyLifeStyle authenticationServiceLifeStyle = DependencyLifeStyle.Transient;

            // application
            dependencyEngine.RegisterAndDecorate<IApplicationConfigurationProvider, ApplicationConfigurationProvider, CachedApplicationConfigurationProvider>(applicationLifeStyle);
            dependencyEngine.Register<IUserSession, AspNetUserSession>(applicationLifeStyle);
            dependencyEngine.Register<ICacheProvider, CacheProvider>(applicationLifeStyle);
            dependencyEngine.Register<ILoggerFactory, LoggerFactory>(applicationLifeStyle);
            dependencyEngine.Register<IHttpContextProvider, HttpContextProvider>(applicationLifeStyle);
            dependencyEngine.Register<IAuthenticationStorage, FormsAuthenticationStorage>(applicationLifeStyle);

            // home
            dependencyEngine.Register<HomeController>(controllerLifeStyle);

            // authentication
            dependencyEngine.Register<AccountController>(controllerLifeStyle);
            dependencyEngine.Register<IAuthenticationProvider, FlickrAuthenticationProvider>(authenticationServiceLifeStyle);

            // photo
            dependencyEngine.Register<PhotoController>(controllerLifeStyle);
            dependencyEngine.Register<IPhotoEngine, FlickrPhotoEngine>(photoServiceLifeStyle);
            dependencyEngine.Register<IFlickrPhotoProvider, FlickrPhotoProvider>(photoServiceLifeStyle);
            dependencyEngine.Register<IFlickrConverter, FlickrConverter>(photoServiceLifeStyle);
            dependencyEngine.Register<IFlickrFactory, FlickrFactory>(photoServiceLifeStyle);
            dependencyEngine.RegisterAndDecorate<IUserEngine, FlickrUserEngine, CachedUserEngine>(photoServiceLifeStyle);

            // opt-out checker
            dependencyEngine.RegisterAndDecorate<IUserService, UserService, CachedUserService>(optOutServiceLifeStyle);
            dependencyEngine.Register<IUserReaderService, UserReaderService>(optOutServiceLifeStyle);

            // legacy
            dependencyEngine.Register<LegacyController>(controllerLifeStyle);

            // opt-out
            dependencyEngine.Register<SettingsController>(controllerLifeStyle);
            dependencyEngine.Register<IUserStorePathProvider, UserStorePathProvider>(optOutServiceLifeStyle);
            dependencyEngine.Register<IUserStore, UserStore>(optOutServiceLifeStyle);
            dependencyEngine.Register<IUserStoreService, UserStoreService>(optOutServiceLifeStyle);
            dependencyEngine.Register<IUserWriterService, UserWriterService>(optOutServiceLifeStyle);

            //exif
            dependencyEngine.Register<IFlickrExifEngine, FlickrExifEngine>(photoServiceLifeStyle);
            dependencyEngine.Register<IFlickrStatisticsEngine, FlickrStatisticsEngine>(photoServiceLifeStyle);

            // test
            dependencyEngine.Register<TestController>(controllerLifeStyle);

            var dependencyResolver = new EnginedDependencyResolver(dependencyEngine);
            DependencyResolver.SetResolver(dependencyResolver);

            return dependencyEngine;
        }
        public static IDependencyEngine Setup(IDependencyEngine dependencyEngine)
        {
            const DependencyLifeStyle applicationLifeStyle           = DependencyLifeStyle.Singleton;
            const DependencyLifeStyle controllerLifeStyle            = DependencyLifeStyle.Transient;
            const DependencyLifeStyle photoServiceLifeStyle          = DependencyLifeStyle.Transient;
            const DependencyLifeStyle optOutServiceLifeStyle         = DependencyLifeStyle.Transient;
            const DependencyLifeStyle authenticationServiceLifeStyle = DependencyLifeStyle.Transient;

            // application
            dependencyEngine.RegisterAndDecorate <IApplicationConfigurationProvider, ApplicationConfigurationProvider, CachedApplicationConfigurationProvider>(applicationLifeStyle);
            dependencyEngine.Register <IUserSession, AspNetUserSession>(applicationLifeStyle);
            dependencyEngine.Register <ICacheProvider, CacheProvider>(applicationLifeStyle);
            dependencyEngine.Register <ILoggerFactory, LoggerFactory>(applicationLifeStyle);
            dependencyEngine.Register <IHttpContextProvider, HttpContextProvider>(applicationLifeStyle);
            dependencyEngine.Register <IAuthenticationStorage, FormsAuthenticationStorage>(applicationLifeStyle);

            // home
            dependencyEngine.Register <HomeController>(controllerLifeStyle);

            // authentication
            dependencyEngine.Register <AccountController>(controllerLifeStyle);
            dependencyEngine.Register <IAuthenticationProvider, FlickrAuthenticationProvider>(authenticationServiceLifeStyle);

            // photo
            dependencyEngine.Register <PhotoController>(controllerLifeStyle);
            dependencyEngine.Register <IPhotoEngine, FlickrPhotoEngine>(photoServiceLifeStyle);
            dependencyEngine.Register <IFlickrPhotoProvider, FlickrPhotoProvider>(photoServiceLifeStyle);
            dependencyEngine.Register <IFlickrConverter, FlickrConverter>(photoServiceLifeStyle);
            dependencyEngine.Register <IFlickrFactory, FlickrFactory>(photoServiceLifeStyle);
            dependencyEngine.RegisterAndDecorate <IUserEngine, FlickrUserEngine, CachedUserEngine>(photoServiceLifeStyle);

            // opt-out checker
            dependencyEngine.RegisterAndDecorate <IUserService, UserService, CachedUserService>(optOutServiceLifeStyle);
            dependencyEngine.Register <IUserReaderService, UserReaderService>(optOutServiceLifeStyle);

            // legacy
            dependencyEngine.Register <LegacyController>(controllerLifeStyle);

            // opt-out
            dependencyEngine.Register <SettingsController>(controllerLifeStyle);
            dependencyEngine.Register <IUserStorePathProvider, UserStorePathProvider>(optOutServiceLifeStyle);
            dependencyEngine.Register <IUserStore, UserStore>(optOutServiceLifeStyle);
            dependencyEngine.Register <IUserStoreService, UserStoreService>(optOutServiceLifeStyle);
            dependencyEngine.Register <IUserWriterService, UserWriterService>(optOutServiceLifeStyle);

            //exif
            dependencyEngine.Register <IFlickrExifEngine, FlickrExifEngine>(photoServiceLifeStyle);
            dependencyEngine.Register <IFlickrStatisticsEngine, FlickrStatisticsEngine>(photoServiceLifeStyle);

            // test
            dependencyEngine.Register <TestController>(controllerLifeStyle);

            var dependencyResolver = new EnginedDependencyResolver(dependencyEngine);

            DependencyResolver.SetResolver(dependencyResolver);

            return(dependencyEngine);
        }
        public static void RegisterComponents(this IDependencyEngine dependencyEngine)
        {
            // Application
            dependencyEngine.Register <IConfigurationProvider, AppSettingConfigurationProvider>(DependencyLifeStyle.Singleton);
            dependencyEngine.Register <IUserSession, AspNetUserSession>(DependencyLifeStyle.Singleton);
            dependencyEngine.Register <ICacheProvider, CacheProvider>(DependencyLifeStyle.Singleton);
            dependencyEngine.Register <ILoggerFactory, NLogLoggerFactory>(DependencyLifeStyle.Singleton);

            // Home
            dependencyEngine.Register <HomeController>(DependencyLifeStyle.PerWebRequest);

            // Authentication
            dependencyEngine.Register <AccountController>(DependencyLifeStyle.PerWebRequest);
            dependencyEngine.Register <IAuthenticationProvider, FlickrAuthenticationProvider>(DependencyLifeStyle.Singleton);

            // Photos
            dependencyEngine.Register <PhotoController>(DependencyLifeStyle.PerWebRequest);
            dependencyEngine.Register <IFlickrFactory, FlickrFactory>(DependencyLifeStyle.Singleton);
            dependencyEngine.Register <IPhotoEngine, FlickrPhotoEngine>(DependencyLifeStyle.Singleton);
            dependencyEngine.RegisterAndDecorate <IUserEngine, FlickrUserEngine, CachedUserEngine>(DependencyLifeStyle.Singleton);
            dependencyEngine.Register <IFlickrPhotoProvider, FlickrPhotoProvider>(DependencyLifeStyle.Singleton);
            dependencyEngine.Register <IFlickrConverter, FlickrConverter>(DependencyLifeStyle.Singleton);

            // Legacy
            dependencyEngine.Register <LegacyController>(DependencyLifeStyle.PerWebRequest);

            // Opt-out
            dependencyEngine.Register <SettingsController>(DependencyLifeStyle.PerWebRequest);
            dependencyEngine.Register <IOptoutUserStorePathProvider, OptoutUserStorePathProvider>(DependencyLifeStyle.Singleton);
            dependencyEngine.Register <IOptoutUserStore, OptoutUserStore>(DependencyLifeStyle.Singleton);
            dependencyEngine.RegisterAndDecorate <IOptoutUserService, OptoutUserService, CachedOptoutUserService>(DependencyLifeStyle.Singleton);
            dependencyEngine.Register <IOptoutUserConfiguratorService, OptoutUserConfiguratorService>(DependencyLifeStyle.Singleton);

            // Test
            dependencyEngine.Register <TestController>(DependencyLifeStyle.PerWebRequest);
        }