Пример #1
0
        public IEnumerable <TPlugin> GetImplementations(Type implements)
        {
            var typeHierarchy      = CsUtility.GetClassHierarchy(implements);
            var allImplementations = typeHierarchy.SelectMany(type => PreSort(_pluginsByImplementation.Value[type]));

            return(_cache.SortedByMetadataDependsOnAndRemoveSuppressed(implements, allImplementations));
        }
Пример #2
0
        public IEnumerable <TPlugin> GetImplementations(Type implements)
        {
            var typeHierarchy      = CsUtility.GetClassHierarchy(implements);
            var allImplementations = typeHierarchy.SelectMany(type => _pluginsByImplementation.Value[type]).ToArray();

            _cache.SortByMetadataDependsOn(implements, allImplementations);

            return(allImplementations);
        }
Пример #3
0
        public void GetTypeHierarchyTest()
        {
            object o        = new DerivedClass();
            string expected = "BaseClass-DerivedClass";
            string actual   = string.Join("-", CsUtility.GetClassHierarchy(o.GetType()).Select(type => type.Name));

            Assert.AreEqual(expected, actual);

            o        = new object();
            expected = "";
            actual   = string.Join("-", CsUtility.GetClassHierarchy(o.GetType()).Select(type => type.Name));
            Assert.AreEqual(expected, actual);
        }