private IEnumerable<IPartRegistry<IContractService>> CreateInstancesAndRetrieveSateliteRegistries(IEnumerable<Type> types)
        {
            var instances = types
                .Select(CreatePartRegistryInstance);

            var locator =
                new PartRegistryLocator(this.registries.Concat(instances));

            return locator.GetRegistries();
        }
        /// <summary>
        /// Locates <see cref="IPartRegistry{TContractService}"/> instances in the domain.
        /// </summary>
        /// <returns>An <see cref="IEnumerable{T}"/> of <see cref="IPartRegistry{TContractService}"/> instances.</returns>
        public IEnumerable<IPartRegistry<IContractService>> GetRegistries()
        {
            var registries =
                GetPublicPartRegistryInstances();

            var locator =
                new PartRegistryLocator(registries);

            return locator.GetRegistries();
        }
Example #3
0
        private IEnumerable <IPartRegistry <IContractService> > CreateInstancesAndRetrieveSateliteRegistries(IEnumerable <Type> types)
        {
            var instances = types
                            .Select(CreatePartRegistryInstance);

            var locator =
                new PartRegistryLocator(this.registries.Concat(instances));

            return(locator.GetRegistries());
        }
        /// <summary>
        /// Locates <see cref="IPartRegistry{TContractService}"/> instances in the domain.
        /// </summary>
        /// <returns>An <see cref="IEnumerable{T}"/> of <see cref="IPartRegistry{TContractService}"/> instances.</returns>
        public IEnumerable <IPartRegistry <IContractService> > GetRegistries()
        {
            var registries =
                GetPublicPartRegistryInstancesInAppDomain(this.domain);

            var locator =
                new PartRegistryLocator(registries);

            return(locator.GetRegistries());
        }
        public static void Run()
        {
            var locator =
                new PartRegistryLocator(new IPartRegistry<DefaultConventionContractService>[]
                {
                    new ConfigurationPartRegistry("mef.configuration"), new ExtensionRegistry()
                });

            var conventionCatalog = new ConventionCatalog(locator);
            var compositionContainer = new CompositionContainer(conventionCatalog);

            var part = new ConventionPart<Bootstrapper>();
            compositionContainer.ComposeParts(part);

            var bootstrapper = part.Imports.First();
            bootstrapper.Main.Run();
        }