Example #1
0
        private List <string> FindPluginBundles(Type[] types)
        {
            var unfilteredCatalogs = InMemoryRavenConfiguration.GetUnfilteredCatalogs(Configuration.Catalog.Catalogs);

            AggregateCatalog unfilteredAggregate = null;

            var innerAggregate = unfilteredCatalogs as AggregateCatalog;

            if (innerAggregate != null)
            {
                unfilteredAggregate = new AggregateCatalog(innerAggregate.Catalogs.OfType <BuiltinFilteringCatalog>());
            }

            if (unfilteredAggregate == null || unfilteredAggregate.Catalogs.Count == 0)
            {
                return(new List <string>());
            }

            return(types
                   .SelectMany(type => unfilteredAggregate.GetExports(new ImportDefinition(info => info.Metadata.ContainsKey("Bundle"), type.FullName, ImportCardinality.ZeroOrMore, false, false)))
                   .Select(info => info.Item2.Metadata["Bundle"] as string)
                   .Where(x => x != null)
                   .Distinct()
                   .OrderBy(x => x)
                   .ToList());
        }