コード例 #1
0
        public void OnLoad(IKernel kernel)
        {
            kernel.Bind(x => x.FromThisAssembly().SelectAllClasses().BindAllInterfaces());
            kernel.Bind(x => x.FromAssemblyContaining <SonosPlayer>().SelectAllClasses().BindAllInterfaces());

            kernel.Rebind <IIdentityProvider>().To <GuidIdentityProvider>().InSingletonScope();
            kernel.Rebind <ServerConfiguration>().ToMethod(x => ServerConfigurationFactory.LoadConfiguration()).InSingletonScope();

            SmapiSoapController.MusicRepository  = () => kernel.Get <IMusicRepository>();
            SmapiSoapController.IdentityProvider = () => kernel.Get <IIdentityProvider>();

            kernel.Bind <ServerBuilder>().ToMethod(context => new ServerBuilder(typeof(SmapiSoapController)));
        }
コード例 #2
0
        public void OnLoad(IKernel kernel)
        {
            kernel.Bind(x => x.FromThisAssembly().SelectAllClasses().BindAllInterfaces());
            kernel.Bind(x => x.FromAssemblyContaining <SonosPlayer>().SelectAllClasses().BindAllInterfaces());
            kernel.Bind(x => x.FromAssemblyContaining <IFileSystem>().SelectAllClasses().BindAllInterfaces());

            kernel.Rebind <ServerConfiguration>().ToMethod(x => ServerConfigurationFactory.LoadConfiguration()).InSingletonScope();
            kernel.Rebind <IIdentityProvider>().To <IdentityProvider>().InSingletonScope();
            kernel.Rebind <ISearchProvider>().To <TopLevelDirectorySearchProvider>().InSingletonScope();
            kernel.Rebind <SmapiSoapControllerDependencies>().To <SmapiSoapControllerDependencies>().InSingletonScope();

            SmapiSoapController.Dependencies = () => kernel.Get <SmapiSoapControllerDependencies>();

            kernel.Bind <LocalMusicServerFactory>().ToMethod(context => new LocalMusicServerFactory(typeof(SmapiSoapController)));
        }