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


C# PluginFamily.SetScopeTo方法代码示例

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


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

示例1: set_the_scope_to_session_hybrid

        public void set_the_scope_to_session_hybrid()
        {
            var family = new PluginFamily(typeof(IServiceProvider));
            family.SetScopeTo(WebLifecycles.HybridSession);

            family.Lifecycle.ShouldBeOfType<HybridSessionLifecycle>();
        }
开发者ID:rhyss,项目名称:structuremap,代码行数:7,代码来源:PluginFamilyTester.cs

示例2: SetScopeToHybrid

        public void SetScopeToHybrid()
        {
            var family = new PluginFamily(typeof(IServiceProvider));

            family.SetScopeTo(WebLifecycles.Hybrid);
            family.Lifecycle.ShouldBeOfType<HybridLifecycle>();
        }
开发者ID:rhyss,项目名称:structuremap,代码行数:7,代码来源:PluginFamilyTester.cs

示例3: SetScopeToHttpContext

        public void SetScopeToHttpContext()
        {
            var family = new PluginFamily(typeof(IServiceProvider));
            family.Lifecycle.ShouldBeOfType<TransientLifecycle>();

            family.SetScopeTo(WebLifecycles.HttpContext);
            family.Lifecycle.ShouldBeOfType<HttpContextLifecycle>();
        }
开发者ID:rhyss,项目名称:structuremap,代码行数:8,代码来源:PluginFamilyTester.cs

示例4: import_from_another_family_will_override_the_build_policy_if_the_initial_policy_is_the_default

        public void import_from_another_family_will_override_the_build_policy_if_the_initial_policy_is_the_default()
        {
            var factory = new InstanceFactory(typeof (IWidget));

            var family = new PluginFamily(typeof (IWidget));
            family.SetScopeTo(InstanceScope.Singleton);

            factory.ImportFrom(family);

            factory.Lifecycle.ShouldBeOfType<SingletonLifecycle>();
        }
开发者ID:satish860,项目名称:StructureMap3,代码行数:11,代码来源:InstanceFactoryTester.cs

示例5: does_override_the_scope_of_the_parent

        public void does_override_the_scope_of_the_parent()
        {
            var family = new PluginFamily(GetType());
            family.SetScopeTo(InstanceScope.Singleton);

            var i1 = new ConfiguredInstance(GetType()).Named("foo");
            i1.SetScopeTo(InstanceScope.ThreadLocal);

            family.AddInstance(i1);

            i1.Lifecycle.ShouldBeOfType<ThreadLocalStorageLifecycle>();
        }
开发者ID:smerrell,项目名称:structuremap,代码行数:12,代码来源:InstanceTester.cs

示例6: do_not_replace_the_build_Lifecycle_if_it_is_the_same_type_as_the_imported_family

        public void do_not_replace_the_build_Lifecycle_if_it_is_the_same_type_as_the_imported_family()
        {
            var originalFamily = new PluginFamily(typeof (IWidget));
            originalFamily.SetScopeTo(InstanceScope.Singleton);
            var factory = new InstanceFactory(originalFamily);

            ILifecycle originalLifecycle = factory.Lifecycle;

            var family = new PluginFamily(typeof (IWidget));
            family.SetScopeTo(InstanceScope.Singleton);

            factory.ImportFrom(family);

            factory.Lifecycle.ShouldBeTheSameAs(originalLifecycle);
        }
开发者ID:satish860,项目名称:StructureMap3,代码行数:15,代码来源:InstanceFactoryTester.cs

示例7: uses_parent_lifecycle_if_none_is_set_on_instance

        public void uses_parent_lifecycle_if_none_is_set_on_instance()
        {
            var family = new PluginFamily(GetType());
            family.SetScopeTo(InstanceScope.Singleton);

            var i1 = new ConfiguredInstance(GetType()).Named("foo");

            family.AddInstance(i1);

            i1.Lifecycle.ShouldBeOfType<SingletonLifecycle>();
        }
开发者ID:smerrell,项目名称:structuremap,代码行数:11,代码来源:InstanceTester.cs

示例8: Configure

 public void Configure(PluginFamily family)
 {
     if (Scope != InstanceScope.Transient) family.SetScopeTo(Scope);
 }
开发者ID:smerrell,项目名称:structuremap,代码行数:4,代码来源:PluginFamilyAttribute.cs

示例9: attachInterceptors

        private void attachInterceptors(PluginFamily family, XmlElement familyElement)
        {
            string contextBase = string.Format("creating an InstanceInterceptor for {0}\n",
                                               family.PluginType.AssemblyQualifiedName);
            familyElement.ForEachChild("*/Interceptor").Do(element =>
            {
                var interceptorMemento = new XmlAttributeInstanceMemento(element);
                string context = contextBase + element.OuterXml;

                _builder.WithSystemObject<ILifecycle>(
                    interceptorMemento,
                    context,
                    lifecycle => family.SetScopeTo(lifecycle));
            });
        }
开发者ID:hp4711,项目名称:structuremap,代码行数:15,代码来源:FamilyParser.cs


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