Exemplo n.º 1
0
        private static void UpdateDependencies()
        {
            var interfaces = DI.GetAllTypes()
                             .Where(t => t.IsAbstract || t.IsInterface)
                             .Where(t => t.GetInterfaces(false).Any(i => i.FullName == typeof(IDependency).FullName));

            foreach (var @interface in interfaces)
            {
                var types = DI.GetAllTypes()
                            .Where(t => t.IsClass && !t.IsAbstract)
                            .Where(t => ReflectionUtils.ImplementsOrImplementsEquivalent(t, @interface));
                var tuple = VersionUtils.GetLastImplementation(Version, types);
                if (tuple != null && tuple.Value.Type != null)
                {
                    LatestImplementations.Add(@interface, tuple.Value.Type);
                }
            }
        }
Exemplo n.º 2
0
        private static void UpdateDependencies()
        {
            LatestImplementations.Clear();

            var bases = DI.GetAllTypes()
                        .Where(t => t.IsAbstract || t.IsInterface)
                        .Where(t =>
                               t.GetInterfaces(false).Any(i => i.FullName() == typeof(IDependency).FullName()) &&
                               t.GetInterfaces(true).All(i => FullName(i) != typeof(IWrapper).FullName()))
                        .Select(i => i.FullName())
                        .Distinct();

            foreach (var @base in bases)
            {
                var types = DI.GetAllTypes()
                            .Where(t => t.IsClass && !t.IsAbstract)
                            .Where(t => ReflectionUtils.ImplementsOrImplementsEquivalent(t, @base));
                var tuple = VersionUtils.GetLastImplementation(Version, types);
                if (tuple != null && tuple.Value.Type != null)
                {
                    LatestImplementations.Add(@base, tuple.Value.Type);
                }
            }
        }