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


C# IResolutionRoot类代码示例

本文整理汇总了C#中IResolutionRoot的典型用法代码示例。如果您正苦于以下问题:C# IResolutionRoot类的具体用法?C# IResolutionRoot怎么用?C# IResolutionRoot使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: Resolve

        public object Resolve(IResolutionRoot resolutionRoot, IResolutionParameters resolutionParameters)
        {
            Type type = resolutionParameters.TypeToResolve;
            TypeInfo typeInfo = type.GetTypeInfo();

            if (typeInfo.IsGenericType)
            {
                var genericType = type.GetGenericTypeDefinition();
                if (genericType == typeof(IEnumerable<>) ||
                    genericType == typeof(ICollection<>) ||
                    genericType == typeof(IList<>) ||
                    genericType == typeof(List<>))
                {
                    return this.GetAllAsList(resolutionRoot, typeInfo.GenericTypeArguments[0], resolutionParameters);
                }
            }

            if (typeInfo.IsArray)
            {
                var argumentType = type.GetElementType();
                return this.GetAllAsArray(resolutionRoot, argumentType, resolutionParameters);
            }

            return resolutionRoot.Get(
                type,
                resolutionParameters.Constraint,
                resolutionParameters.Parameters.ToArray());
        }
开发者ID:BrunoJuchli,项目名称:ninject.extensions.staticproxy,代码行数:28,代码来源:InstanceResolver.cs

示例2: NinjectDependencyScope

        public NinjectDependencyScope(IResolutionRoot resolver)
        {
            if (resolver == null)
                throw new ArgumentNullException("resolver");

            this.resolver = resolver;
        }
开发者ID:pieterderycke,项目名称:BeerStockExchange,代码行数:7,代码来源:NinjectDependencyScope.cs

示例3: ChildKernel

 /// <summary>
 /// Initializes a new instance of the <see cref="ChildKernel"/> class.
 /// </summary>
 /// <param name="parent">The parent.</param>
 /// <param name="modules">The modules.</param>
 public ChildKernel(IResolutionRoot parent, params INinjectModule[] modules)
     : base(modules)
 {
     this.parent = parent;
     this.Components.RemoveAll<IActivationCache>();
     this.Components.Add<IActivationCache, ChildActivationCache>();
 }
开发者ID:tgeens,项目名称:ninject.extensions.childkernel,代码行数:12,代码来源:ChildKernel.cs

示例4: NinjectServiceScope

 public NinjectServiceScope(
     IResolutionRoot resolver,
     IEnumerable<IParameter> inheritedParameters)
 {
     _scope = new ScopeParameter();
     inheritedParameters = inheritedParameters.AddOrReplaceScopeParameter(_scope);
     _serviceProvider = new NinjectServiceProvider(resolver, inheritedParameters.ToArray());
 }
开发者ID:stevenliujw,项目名称:DependencyInjection,代码行数:8,代码来源:NinjectServiceScopeFactory.cs

示例5: CreateAuthKernel

 private static ChildKernel CreateAuthKernel(IResolutionRoot parent)
 {
     var kernel = new ChildKernel(parent, new ServerModule(), new AuthServerModule());
     kernel.Rebind<IPacketCodeTable>().To<AuthPacketCodeTableV75>().InSingletonScope();
     kernel.Rebind<IAuthenticator>().To<StubAuthenticator>().InSingletonScope();
     kernel.Rebind<IAccountProvider>().To<StubAccountProvider>().InSingletonScope();
     return kernel;
 }
开发者ID:shoftee,项目名称:OpenStory,代码行数:8,代码来源:SimpleBootstrapper.cs

示例6: WcfBootstrapper

        /// <summary>
        /// Initializes it all.
        /// </summary>
        public WcfBootstrapper(IEnumerable<OsWcfConfiguration> configurations, IResolutionRoot resolutionRoot, ILogger logger)
            : base(resolutionRoot, logger)
        {
            this.configurations = configurations.ToList();
            this.hosts = new List<ServiceHost>(this.configurations.Count);

            this.isDisposed = false;
        }
开发者ID:shoftee,项目名称:OpenStory,代码行数:11,代码来源:WcfBootstrapper.cs

示例7: GetAllAsArray

 public object GetAllAsArray(IResolutionRoot resolutionRoot, Type type, IResolutionParameters resolutionParameters)
 {
     var list = this.GetAllAsList(resolutionRoot, type, resolutionParameters);
     return typeof(Enumerable)
         .GetTypeInfo()
         .GetDeclaredMethod("ToArray")
         .MakeGenericMethod(type)
         .Invoke(null, new[] { list });
 }
开发者ID:BrunoJuchli,项目名称:ninject.extensions.staticproxy,代码行数:9,代码来源:InstanceResolver.cs

示例8: ChildKernel

        /// <summary>
        /// Initializes a new instance of the <see cref="ChildKernel"/> class.
        /// </summary>
        /// <param name="parent">The parent.</param>
        /// <param name="modules">The modules.</param>
        public ChildKernel(IResolutionRoot parent, params INinjectModule[] modules)
            : base(modules)
        {
            this.parent = parent;
            this.Components.RemoveAll<IActivationCache>();
            this.Components.Add<IActivationCache, ChildActivationCache>();

            this.Components.RemoveAll<IConstructorScorer>();
            this.Components.Add<IConstructorScorer, StandardConstructorScorerForChildKernel>();
        }
开发者ID:mikkelfish,项目名称:ninject.extensions.childkernel,代码行数:15,代码来源:ChildKernel.cs

示例9: Dispose

 public void Dispose()
 {
     //IDisposable disposable = resolver as IDisposable;
     //if (disposable != null)
     //    disposable.Dispose();
     resolver = null;
 }
开发者ID:305088020,项目名称:ChART,代码行数:7,代码来源:NinjectDependencyScope.cs

示例10: Dispose

 public void Dispose()
 {
     var disposable = _resolver as IDisposable;
     if (disposable != null)
         disposable.Dispose();
     _resolver = null;
 }
开发者ID:jmptrader,项目名称:spa-template,代码行数:7,代码来源:DependencyScope.cs

示例11: NinjectDependencyResolver

        public NinjectDependencyResolver()
        {
            IKernel kernel = new StandardKernel();
            resolutionRoot = kernel;

            DoBindings(kernel);
        }
开发者ID:Nordis,项目名称:Mvc4WebApiRavenDb,代码行数:7,代码来源:NinjectDependencyResolver.cs

示例12: Dispose

 public void Dispose()
 {
     IDisposable disposable = resolver as IDisposable;
     if (disposable != null)
         disposable.Dispose();
     resolver = null;
 }
开发者ID:zicjin,项目名称:SpiderMan,代码行数:7,代码来源:NinjectDependencyScope.cs

示例13: Dispose

 public void Dispose()
 {
     var disposable = _resolutionRoot as IDisposable;
     if(disposable!=null)
         disposable.Dispose();
     _resolutionRoot = null;
 }
开发者ID:tugberkugurlu,项目名称:ProWebAPI.Samples,代码行数:7,代码来源:NInjectDependencyScope.cs

示例14: Dispose

        public void Dispose()
        {
            var disposable = resolver as IDisposable;

            disposable?.Dispose();

            resolver = null;
        }
开发者ID:COTB,项目名称:k94warriors,代码行数:8,代码来源:NinjectDependencyScope.cs

示例15: Dispose

        public void Dispose()
        {
            var root = this.resolutionRoot as IDisposable;
            if (root != null)
                root.Dispose();

            resolutionRoot = null;
        }
开发者ID:julplee,项目名称:NinjectWithMvcAndWebApi,代码行数:8,代码来源:NinjectDependencyScope.cs


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