Пример #1
0
        public void GetNamedExports(IContainer container)
        {
            var v3Container = (TestUtilities.V3ContainerWrapper)container;

            var v1Container = new MefV1.Hosting.CompositionContainer(v3Container.ExportProvider.AsExportProvider());
            var apples      = v1Container.GetExportedValues <Apple>(typeof(Apple).FullName);

            Assert.Equal(1, apples.Count());

            apples = v1Container.GetExportedValues <Apple>("SomeContract");
            Assert.Equal(1, apples.Count());

            apples = v1Container.GetExportedValues <Apple>("NoContractLikeThis");
            Assert.Equal(0, apples.Count());
        }
Пример #2
0
        private void EnsureTransformers(IDocumentStore singleShardStore)
        {
            var catalog   = new System.ComponentModel.Composition.Hosting.AssemblyCatalog(typeof(TransformerTest).Assembly);
            var container = new System.ComponentModel.Composition.Hosting.CompositionContainer(catalog);

            container.ComposeParts();

            foreach (var task in container.GetExportedValues <AbstractTransformerCreationTask>())
            {
                task.Execute(singleShardStore);
            }
        }