/// <summary>Marks the registration as having a specific constructor parameter discovered by name, whose value is resolved by a callback. </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> WithNamedResolvedParam <T>(string name, Func <IResolutionContext, T> callback)
        {
            // Create an IResolutionContext from the current Kernel
            var context = new NinjectResolutionContext(_bindingResult.Kernel);

            // Tell Ninject to inboke our callback when the time comes
            _bindingResult.WithConstructorArgument(name, defer => callback.Invoke(context));
            return(this);
        }
示例#2
0
        /// <summary>Marks the registration as having a specific constructor parameter discovered by type, whose value is resolved by a callback. </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>(Func <IResolutionContext, T> callback)
        {
            // Create an IResolutionContext from the current Kernel
            var context = new NinjectResolutionContext(_bindingResult.Kernel);

            // Tell Ninject to inboke our callback when the time comes
            _bindingResult.WithConstructorArgument(null, defer => callback.Invoke(context));
            return(this);
        }