Ejemplo n.º 1
0
        private CompositionContainer PrepareCompositionContainer()
        {
            // Create the MEF container based on the catalog
            var compositionContainer = new CompositionContainer(m_Catalog, m_Providers);

            // Create composition batch and add the MEF container and the Unity
            // container to the MEF
            var batch = new CompositionBatch();

            batch.AddExportedObject(compositionContainer);
            batch.AddExportedObject(Container);

            // Prepare container
            compositionContainer.Compose(batch);

            if (m_Register)
            {
                Container.RegisterInstance(compositionContainer);
            }

            return(compositionContainer);
        }