/// <summary>
        /// Get the instance.
        /// </summary>
        /// <param name="context">Context used to create instances.</param>
        /// <param name="instance">The instance.</param>
        /// <returns>
        /// Instance if found; otherwise null.
        /// </returns>
        public InstanceResult GetInstance(CreateContext context, out object instance)
        {
            var strategyContext = new ExternalInstanceStrategyContext
            {
                BuildPlan = this,
                CreateContext = context
            };

            var result =  _instanceStrategy.GetInstance(strategyContext, out instance);
            if (result == InstanceResult.Created && _callback != null)
                instance = _callback.InstanceCreated(context, this, instance);

            return result;
        }
Beispiel #2
0
        /// <summary>
        /// Get the instance.
        /// </summary>
        /// <param name="context">Context used to create instances.</param>
        /// <param name="instance">The instance.</param>
        /// <returns>
        /// Instance if found; otherwise null.
        /// </returns>
        public InstanceResult GetInstance(CreateContext context, out object instance)
        {
            var strategyContext = new ExternalInstanceStrategyContext
            {
                BuildPlan     = this,
                CreateContext = context
            };

            var result = _instanceStrategy.GetInstance(strategyContext, out instance);

            if (result == InstanceResult.Created && _callback != null)
            {
                instance = _callback.InstanceCreated(context, this, instance);
            }

            return(result);
        }