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


C# Registry.As方法代码示例

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


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

示例1: Apply

        public void Apply(PluginGraph graph)
        {
            var registry = new Registry();

            _interfaces.Each(@interface =>
            {
                var expression = registry.For(@interface);
                ConfigureFamily(expression);

                var exactMatches = _concretions.Where(x => x.CanBeCastTo(@interface)).ToArray();
                if (exactMatches.Length == 1)
                {
                    expression.Use(exactMatches.Single());
                }
                else
                {
                    exactMatches.Each(type => expression.Add(type));
                }


                if ([email protected]())
                {
                    addConcretionsThatCouldBeClosed(@interface, expression);
                }
            });

            _concretions.Each(t => graph.ConnectedConcretions.Fill(t));
            registry.As<IPluginGraphConfiguration>().Configure(graph);
        }
开发者ID:goraw,项目名称:structuremap,代码行数:29,代码来源:GenericConnectionScanner.cs

示例2: Apply

        public void Apply(PluginGraph graph)
        {
            var registry = new Registry();

            _interfaces.Each(@interface => {
                var expression = registry.For(@interface);
                ConfigureFamily(expression);

                _concretions.Where(x => x.CanBeCastTo(@interface)).Each(type => expression.Add(type));
            });

            registry.As<IPluginGraphConfiguration>().Configure(graph);
        }
开发者ID:flq,项目名称:structuremap,代码行数:13,代码来源:GenericConnectionScanner.cs

示例3: Configure

        /// <summary>
        ///   Add configuration to a PluginGraph with the Registry DSL
        /// </summary>
        /// <param name = "action"></param>
        public void Configure(Action<Registry> action)
        {
            var registry = new Registry();
            action(registry);

            registry.As<IPluginGraphConfiguration>().Configure(this);
        }
开发者ID:rhyss,项目名称:structuremap,代码行数:11,代码来源:PluginGraph.cs

示例4: Process_to_PluginGraph

        public void Process_to_PluginGraph()
        {
            var graph = new PluginGraph();
            var scanner = new DefaultConventionScanner();

            var registry = new Registry();

            scanner.Process(typeof (Convention), registry);

            registry.As<IPluginGraphConfiguration>().Configure(graph);

            graph.Families.Has(typeof (IServer)).ShouldBeFalse();
            graph.Families.Has(typeof (IConvention)).ShouldBeTrue();

            var family = graph.Families[typeof (IConvention)];
            family.Instances.Count().ShouldBe(1);
        }
开发者ID:RANENTONG,项目名称:structuremap,代码行数:17,代码来源:DefaultConventionScanningTester.cs


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