示例#1
0
        /// <summary>
        /// Gets the factory which will create an instance of the type indicated by <see cref="ResolveContext.RequestedType"/>
        /// of the passed <paramref name="context"/>.
        /// </summary>
        /// <param name="context">The context containing the requested type and any scope which is currently in force.</param>
        /// <returns>Always returns a reference to a delegate - but note that if
        /// <see cref="CanResolve(Type)"/> returns false for the same context, then the target's
        /// delegate will likely throw an exception.</returns>
        public Func <ResolveContext, object> GetFactory(ResolveContext context)
        {
#if !ENABLE_IL_EMIT
            return(_cache.Get(context));
#else
            return(_dynCache.GetFactory(context.RequestedType));
#endif
        }