本文整理汇总了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>();
}
示例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);
}
示例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));
}
示例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>();
}