Ejemplo n.º 1
0
        /// <summary>
        /// Checks the container to see if the contract is implemented with the
        /// specified concrete implementation.
        /// </summary>
        /// <typeparam name="TContract"></typeparam>
        /// <typeparam name="TImplementation"></typeparam>
        /// <param name="container"></param>
        /// <param name="isSingleton"></param>
        /// <returns></returns>
        public static bool IsRegisteredAs <TContract, TImplementation>(this CCLLC.Core.IIocContainer container, bool isSingleton = false) where TImplementation : class
        {
            var item = container.Resolve <TContract>() as TImplementation;

            if (item == null)
            {
                return(false);
            }

            return(container.IsSingleton <TContract>() == isSingleton);
        }