internal void PopulateDefaultParts(string entryAssemblyName)
        {
            var entryAssembly         = Assembly.Load(new AssemblyName(entryAssemblyName));
            var assembliesProvider    = new ApplicationAssembliesProvider();
            var applicationAssemblies = assembliesProvider.ResolveAssemblies(entryAssembly);

            foreach (var assembly in applicationAssemblies)
            {
                var partFactory = ApplicationPartFactory.GetApplicationPartFactory(assembly);
                foreach (var part in partFactory.GetApplicationParts(assembly))
                {
                    ApplicationParts.Add(part);
                }
            }
        }
示例#2
0
        internal void PopulateDefaultParts(string entryAssemblyName)
        {
            var assemblies = GetApplicationPartAssemblies(entryAssemblyName);

            var seenAssemblies = new HashSet <Assembly>();

            foreach (var assembly in assemblies)
            {
                if (!seenAssemblies.Add(assembly))
                {
                    // "assemblies" may contain duplicate values, but we want unique ApplicationPart instances.
                    // Note that we prefer using a HashSet over Distinct since the latter isn't
                    // guaranteed to preserve the original ordering.
                    continue;
                }

                var partFactory = ApplicationPartFactory.GetApplicationPartFactory(assembly);
                foreach (var applicationPart in partFactory.GetApplicationParts(assembly))
                {
                    ApplicationParts.Add(applicationPart);
                }
            }
        }