/// <summary>Marks the registration as having a specific constructor parameter discovered by type, whose value is resolved by the container (when given the name of the service). </summary>
        /// <typeparam name="T">The type of the service to resolve in order to pass in as the value of the parameter.</typeparam>
        /// <returns>.</returns>
        public IServiceRegistrarModifier <TContract, TImplementation> WithResolvedParam <T>(string serviceName)
        {
            var resolver = new NinjectResolver(_bindingResult.Kernel);

            _bindingResult.WithConstructorArgument(null, defer => resolver.Resolve <T>());
            return(this);
        }
示例#2
0
        /// <summary>Marks the registration as having a specific constructor parameter discovered by type, whose value is resolved by the container (when given the name of the service). </summary>
        /// <typeparam name="T">The type of the service to resolve in order to pass in as the value of the parameter.</typeparam>
        /// <returns>.</returns>
        public IRuntimeTypeRegistrarModifier <TContract> WithResolvedParam <T>(string serviceName)
        {
            NinjectResolver resolver   = new NinjectResolver(_bindingResult.Kernel);
            var             paramValue = resolver.Resolve <T>(serviceName);

            _bindingResult.WithConstructorArgument(null, paramValue);
            return(this);
        }
 public NinjectResolutionContext(IKernel kernel)
 {
     _resolver = new NinjectResolver(kernel);
 }
 public NinjectResolutionContext(IContext context)
 {
     _resolver = new NinjectResolver(context.Kernel);
 }