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


C# IRegistry.For方法代码示例

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


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

示例1: Register

        public static void Register(IRegistry registry)
        {
            if(registry == null)
                throw new ArgumentNullException("registry");

            registry.For<IConfigurationManager>().Singleton().Use<ConfigurationManagerWrapper>();
        }
开发者ID:HansKindberg-Net,项目名称:HansKindberg,代码行数:7,代码来源:Registry.cs

示例2: ConfigureClass

        private static void ConfigureClass(Type type, IRegistry registry, FireOptions fireOption, DependencyMap dependencyMap)
        {
            var inst = new LooseConstructorInstance(context =>
            {
                var ctorArgs = type
                    .GetGreediestCtor()
                    .GetParameters()
                    .Select(p => context.GetInstance(p.ParameterType));

                return Notifiable.MakeForClass(type, fireOption, ctorArgs.ToArray(), new ProxyGenerator(), dependencyMap);
            });

            registry.For(type).Use(inst);
        }
开发者ID:jonfuller,项目名称:structuremap-autonotify,代码行数:14,代码来源:AutoNotifyPredicateConvention.cs

示例3: ConfigureInterface

 private static void ConfigureInterface(Type type, IRegistry registry, FireOptions fireOption, DependencyMap dependencyMap)
 {
     registry
         .For(type)
         .EnrichWith((context, obj) => Notifiable.MakeForInterface(type, obj, fireOption, new ProxyGenerator(), dependencyMap));
 }
开发者ID:jonfuller,项目名称:structuremap-autonotify,代码行数:6,代码来源:AutoNotifyPredicateConvention.cs

示例4: Register

        public static void Register(IRegistry registry)
        {
            if(registry == null)
                throw new ArgumentNullException("registry");

            registry.For<HttpApplicationState>().HybridHttpOrThreadLocalScoped().Use(() => HttpContext.Current.Application);
            registry.For<HttpApplicationStateBase>().HybridHttpOrThreadLocalScoped().Use<HttpApplicationStateWrapper>();
            registry.For<HttpContext>().HybridHttpOrThreadLocalScoped().Use(() => HttpContext.Current);
            registry.For<HttpContextBase>().HybridHttpOrThreadLocalScoped().Use<HttpContextWrapper>();
            registry.For<HttpRequest>().HybridHttpOrThreadLocalScoped().Use(() => HttpContext.Current.Request);
            registry.For<HttpRequestBase>().HybridHttpOrThreadLocalScoped().Use<HttpRequestWrapper>();
            registry.For<HttpResponse>().HybridHttpOrThreadLocalScoped().Use(() => HttpContext.Current.Response);
            registry.For<HttpResponseBase>().HybridHttpOrThreadLocalScoped().Use<HttpResponseWrapper>();
            registry.For<HttpServerUtility>().HybridHttpOrThreadLocalScoped().Use(() => HttpContext.Current.Server);
            registry.For<HttpServerUtilityBase>().HybridHttpOrThreadLocalScoped().Use<HttpServerUtilityWrapper>();
            registry.For<HttpSessionState>().HybridHttpOrThreadLocalScoped().Use(() => HttpContext.Current.Session);
            registry.For<HttpSessionStateBase>().HybridHttpOrThreadLocalScoped().Use<HttpSessionStateWrapper>();

            registry.For<IHtmlDocumentFactory>().Singleton().Use<DefaultHtmlDocumentFactory>();
            registry.For<IHtmlInvestigator>().Singleton().Use<DefaultHtmlInvestigator>();
            registry.For<IHtmlTransformerFactory>().Singleton().Use<DefaultHtmlTransformerFactory>();
            registry.For<IHtmlTransformingContext>().Singleton().Use<DefaultHtmlTransformingContext>();
            registry.For<IHtmlTransformingInitializer>().Singleton().Use<DefaultHtmlTransformingInitializer>();
        }
开发者ID:HansKindberg-Net,项目名称:HansKindberg,代码行数:24,代码来源:Registry.cs


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