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


C# PluginGraph.Scan方法代码示例

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


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

示例1: FindPluginFamilies

        public void FindPluginFamilies()
        {
            var graph = new PluginGraph();
            graph.Scan(x => { x.Assembly("StructureMap.Testing.Widget"); });

            graph.FindFamily(typeof (IWidget)).DefaultInstanceKey = "Blue";
            graph.CreateFamily(typeof (WidgetMaker));

            graph.Seal();

            foreach (PluginFamily family in graph.PluginFamilies)
            {
                Console.WriteLine(family.PluginType.AssemblyQualifiedName);
            }

            Assert.AreEqual(5, graph.FamilyCount);
        }
开发者ID:hp4711,项目名称:structuremap,代码行数:17,代码来源:PluginGraphTester.cs

示例2: FindPlugins

        public void FindPlugins()
        {
            var graph = new PluginGraph();
            graph.Scan(x =>
            {
                x.Assembly("StructureMap.Testing.Widget");
                x.Assembly("StructureMap.Testing.Widget2");
            });

            graph.FindFamily(typeof (Rule));

            graph.Seal();

            PluginFamily family = graph.FindFamily(typeof (Rule));
            Assert.IsNotNull(family);
            Assert.AreEqual(5, family.PluginCount, "There are 5 Rule classes in the two assemblies");
        }
开发者ID:hp4711,项目名称:structuremap,代码行数:17,代码来源:PluginGraphTester.cs

示例3: PutsRightNumberOfPluginsIntoAFamily

        public void PutsRightNumberOfPluginsIntoAFamily()
        {
            var graph = new PluginGraph();

            graph.Scan(x => { x.Assembly("StructureMap.Testing.Widget"); });

            graph.FindFamily(typeof (IWidget)).DefaultInstanceKey = "Blue";
            graph.Seal();

            PluginFamily family = graph.FindFamily(typeof (IWidget));
            Assert.IsNotNull(family);

            Assert.AreEqual("Blue", family.DefaultInstanceKey);

            Assert.AreEqual(4, family.PluginCount, "3 different IWidget classes are marked as Pluggable");
        }
开发者ID:hp4711,项目名称:structuremap,代码行数:16,代码来源:PluginGraphTester.cs

示例4: PicksUpManuallyAddedPlugin

        public void PicksUpManuallyAddedPlugin()
        {
            var graph = new PluginGraph();

            graph.Scan(x => { x.Assembly("StructureMap.Testing.Widget"); });

            graph.FindFamily(typeof (IWidget)).DefaultInstanceKey = "Blue";

            PluginFamily family = graph.FindFamily(typeof (IWidget));
            family.AddPlugin(typeof (NotPluggableWidget), "NotPluggable");

            graph.Seal();

            Assert.IsNotNull(family);

            Assert.AreEqual(
                5,
                family.PluginCount,
                "5 different IWidget classes are marked as Pluggable, + the manual add");
        }
开发者ID:hp4711,项目名称:structuremap,代码行数:20,代码来源:PluginGraphTester.cs

示例5: SetUp

        public void SetUp()
        {
            var graph = new PluginGraph();

            graph.Scan(x => x.Assembly("StructureMap.Testing.Widget"));

            DataMother.WriteDocument("IntegratedTest.XML");
            MementoSource source1 =
                new XmlFileMementoSource("IntegratedTest.XML", "GrandChildren", "GrandChild");

            MementoSource source2 = new XmlFileMementoSource("IntegratedTest.XML", "Children", "Child");
            MementoSource source3 = new XmlFileMementoSource("IntegratedTest.XML", "Parents", "Parent");

            graph.FindFamily(typeof (GrandChild)).AddMementoSource(source1);
            graph.FindFamily(typeof (Child)).AddMementoSource(source2);
            graph.FindFamily(typeof (Parent)).AddMementoSource(source3);

            container = new Container(graph);
        }
开发者ID:hp4711,项目名称:structuremap,代码行数:19,代码来源:IntegratedTester.cs

示例6: CanCreateTheAutoFilledInstance

        public void CanCreateTheAutoFilledInstance()
        {
            // Builds a PluginGraph that includes all of the PluginFamily's and Plugin's
            // defined in this file
            var pluginGraph = new PluginGraph();
            pluginGraph.Scan(x => x.Assembly(Assembly.GetExecutingAssembly()));
            pluginGraph.Seal();

            var manager = new Container(pluginGraph);

            var mustang = (Mustang) manager.GetInstance(typeof (IAutomobile), "Mustang");

            Assert.IsNotNull(mustang);
            Assert.IsTrue(mustang.Engine is PushrodEngine);
        }
开发者ID:joshuaflanagan,项目名称:structuremap,代码行数:15,代码来源:PluginTester.cs


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