當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。