/// <summary>
        /// Gets the instance.
        /// </summary>
        /// <param name="dependencyInfo">The binding info.</param>
        /// <returns>
        /// Instance of Dependency Object.
        /// </returns>
        /// <author>Anwar</author>
        /// <date>11/9/2011</date>
        public object GetInstance(IBindingInfo dependencyInfo)
        {
            object          instance;
            HttpContextBase context = contextFunc();

            if (context != null && !context.IsFakeContext())
            {
                Dictionary <string, object> instanceCache = context.Items[IocConstants.LifetimeManagerKey] as Dictionary <string, object>
                                                            ??
                                                            new Dictionary <string, object>(StringComparer.OrdinalIgnoreCase);

                if (instanceCache.ContainsKey(dependencyInfo.UniqueID))
                {
                    instance = instanceCache[dependencyInfo.UniqueID];
                }
                else
                {
                    instance = dependencyInfo.Instance();

                    instanceCache.Add(dependencyInfo.UniqueID, instance);
                }

                context.Items[IocConstants.LifetimeManagerKey] = instanceCache;
            }
            else
            {
                instance = dependencyInfo.Instance();
            }

            return(instance);
        }
        /// -------------------------------------------------------------------------------------------------
        /// <summary>
        /// Gets the instance.
        /// </summary>
        /// <param name="dependencyInfo">
        /// Information describing the dependency.
        /// </param>
        /// <returns>
        /// Instance of Dependency Object.
        /// </returns>
        /// -------------------------------------------------------------------------------------------------
        public object GetInstance(IBindingInfo dependencyInfo)
        {
            if (Instances.Value.ContainsKey(dependencyInfo.Instance))
            {
                return(Instances.Value[dependencyInfo.Instance]);
            }

            lock (SyncLock.Value)
            {
                if (Instances.Value.ContainsKey(dependencyInfo.Instance))
                {
                    return(Instances.Value[dependencyInfo.Instance]);
                }

                object instance = dependencyInfo.Instance();

                Instances.Value.Add(dependencyInfo.Instance, instance);

                return(instance);
            }
        }
        /// <summary>
        /// Gets the instance.
        /// </summary>
        /// <param name="dependencyInfo">The binding info.</param>
        /// <returns>
        /// Instance of Dependency Object.
        /// </returns>
        /// <author>Anwar</author>
        /// <date>11/9/2011</date>
        public object GetInstance(IBindingInfo dependencyInfo)
        {
            object          instance = null;
            HttpContextBase context  = contextFunc();

            if (context != null)
            {
                instance = context.Items[dependencyInfo.UniqueID];

                if (instance == null)
                {
                    instance = dependencyInfo.Instance();

                    context.Items[dependencyInfo.UniqueID] = instance;
                }
                else
                {
                    instance = null;
                }
            }

            return(instance);
        }
 public object GetInstance(IBindingInfo dependencyInfo)
 {
     return(this.CachedInstance ?? (this.CachedInstance = dependencyInfo.Instance()));
 }
        public object GetInstance(IBindingInfo dependencyInfo)
        {
            object instance = dependencyInfo.Instance();

            return(instance);
        }