当前位置: 首页>>代码示例>>C#>>正文


C# TinyIoCContainer.CanResolve方法代码示例

本文整理汇总了C#中TinyIoCContainer.CanResolve方法的典型用法代码示例。如果您正苦于以下问题:C# TinyIoCContainer.CanResolve方法的具体用法?C# TinyIoCContainer.CanResolve怎么用?C# TinyIoCContainer.CanResolve使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TinyIoCContainer的用法示例。


在下文中一共展示了TinyIoCContainer.CanResolve方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CreateContainerForAssembly

        public TinyIoCContainer CreateContainerForAssembly(Assembly assembly)
        {
            IPackageManagerModule module = CreateModule(assembly);
            Type packageManagerType = module.PackageManagerType;

            Debug.Assert(PackageManagerType.IsAssignableFrom(packageManagerType));

            var container = new TinyIoCContainer();
            module.RegisterDependencies(container);
            if (container.CanResolve<IPackageManager>())
            {
                throw new ConfigurationException("Package Manager should not be manually configured in the dependency injection container");
            }
            container.Register(PackageManagerType, packageManagerType);
            container.Register<ILogger>((c, p) => new Logger(new Context(packageManagerType.ToString()), _log));
            container.Register<IShellCommandRunner, ShellCommandRunner>();
            return container;
        }
开发者ID:TomPeters,项目名称:chooie,代码行数:18,代码来源:PackageManagerContainerFactory.cs

示例2: registerDefaultTypes

        static void registerDefaultTypes(TinyIoCContainer kernel)
        {
            var toRegister = new[] {
                new { Interface = typeof(IProcessFactory), Impl = typeof(DefaultProcessFactory) },
                new { Interface = typeof(IErrorViewModel), Impl = typeof(ErrorViewModel) },
                new { Interface = typeof(IWelcomeViewModel), Impl = typeof(WelcomeViewModel) },
                new { Interface = typeof(IInstallingViewModel), Impl = typeof(InstallingViewModel) },
                new { Interface = typeof(IUninstallingViewModel), Impl = typeof(UninstallingViewModel) },
                new { Interface = typeof(IViewFor<ErrorViewModel>), Impl = typeof(ErrorView) },
                new { Interface = typeof(IViewFor<WelcomeViewModel>), Impl = typeof(WelcomeView) },
                new { Interface = typeof(IViewFor<InstallingViewModel>), Impl = typeof(InstallingView) },
                new { Interface = typeof(IViewFor<UninstallingViewModel>), Impl = typeof(UninstallingView) },
            };

            foreach (var pair in toRegister.Where(pair => !kernel.CanResolve(pair.Interface))) {
                kernel.Register(pair.Interface, pair.Impl);
            }
        }
开发者ID:rzhw,项目名称:Squirrel.Windows,代码行数:18,代码来源:WixUiBootstrapper.cs


注:本文中的TinyIoCContainer.CanResolve方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。