private static T GetServiceImpl <T>(Type aspectType, MemberInfo targetElement) where T : class
        {
            // The rule implementation is naive but this is for testing purpose only.
            foreach (object rule in rules)
            {
                DependencyRule <T> typedRule = rule as DependencyRule <T>;
                if (typedRule == null)
                {
                    continue;
                }

                T service = typedRule.Rule(aspectType, targetElement);
                if (service != null)
                {
                    return(service);
                }
            }

            if (container == null)
            {
                throw new InvalidOperationException();
            }

            // Fallback to the container, which should be the default and production behavior.
            return(container.GetExport <T>().Value);
        }