Пример #1
0
        public static CompositionContainer BuildContainer(ReflectionContext builder = null)
        {
            var batch     = new CompositionBatch();
            var catalog   = new SafeDirectoryCatalog(BinDir, builder);
            var container = new CompositionContainer(catalog);

            container.Compose(batch);

            return(container);
        }
Пример #2
0
        public static IEnumerable <Type> GetExportedTypes <T>(Action <RegistrationBuilder> action)
        {
            RegistrationBuilder builder = null;

            if (action != null)
            {
                builder = new RegistrationBuilder();

                action(builder);
            }

            var catalog = new SafeDirectoryCatalog(BinDir, builder);

            return(catalog.Parts
                   .Select(part => ComposablePartExportType <T>(part))
                   .Where(t => t != null));
        }