Example #1
0
        ////////////////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Gets the implicit types.
        /// </summary>
        /// <returns>The implicit types.</returns>
        /// <param name="boundType">Bound type.</param>
        protected internal static SetShim <Type> GetImplicitTypes(Type boundType)
        {
            var implicitTypes = new SetShim <Type>();

            foreach (Type iFace in boundType.GetInterfaces())
            {
                implicitTypes.Add(iFace);
            }

            Type wTypeChain = boundType;

            while ((wTypeChain = wTypeChain.BaseType) != null && wTypeChain != typeof(object))
            {
                implicitTypes.Add(wTypeChain);
            }

            return(implicitTypes);
        }
        /// <summary>
        /// Gets the implicit types.
        /// </summary>
        /// <returns>The implicit types.</returns>
        /// <param name="boundType">Bound type.</param>
        private static SetShim <BindingKey> GetImplicitTypes(BindingKey bindingKey)
        {
            var implicitTypes = new SetShim <BindingKey>();
            var bindingType   = bindingKey.BindingType;

            foreach (Type iFace in bindingType.GetInterfaces())
            {
                implicitTypes.Add(BindingKey.Get(iFace));
            }

            Type wTypeChain = bindingType;

            while ((wTypeChain = wTypeChain.BaseType) != null && wTypeChain != typeof(object))
            {
                implicitTypes.Add(BindingKey.Get(wTypeChain));
            }

            return(implicitTypes);
        }
Example #3
0
            public Expression GetResolveExpression(SetShim <Type> callerDeps)
            {
                lock (syncLock) {
                    Expression <Func <CType> > expr;
                    if (singleton)
                    {
                        var instance = DoResolveTyped();
                        expr = () => instance;
                    }
                    else
                    {
                        if (!isVerifiedNotRecursive)
                        {
                            DoResolveTyped();
                        }
                        expr = resolverExpression;
                    }

                    callerDeps.UnionWith(dependencies);
                    callerDeps.Add(bindType);

                    return(expr.Body);
                }
            }