public static async Task TouchCatalog(ComposablePartCatalog composablePartCatalog)
        {
            var aggregate = composablePartCatalog as AggregateCatalog;
            if (aggregate != null)
            {
                //foreach (var catalog in aggregate.Catalogs)
                //{
                //    TouchCatalog(catalog);
                //}

                var actionList = new List<Task>();
                foreach (var item in aggregate.Catalogs)
                {
                    actionList.Add(TouchCatalog(item));
                }

                await Task.WhenAll(actionList.ToArray());
            }
            else
            {
                var metadataAssemblyCatalog = composablePartCatalog as MetadataAssemblyCatalog;
                if (metadataAssemblyCatalog != null)
                {
                    await metadataAssemblyCatalog.Realize();
                }

                foreach (var part in composablePartCatalog.Parts)
                {
                    TouchPart(part);
                }
            }
        }
 public MEFedMVVMExportProvider(ComposablePartCatalog catalog)
 {
     _exportProvider = new CatalogExportProvider(catalog);
     //support recomposition
     _exportProvider.ExportsChanged += (s, e) => OnExportsChanged(e); 
     _exportProvider.ExportsChanging += (s, e) => OnExportsChanging(e);
 }
Example #3
0
 public GenericCatalog(ComposablePartCatalog catalog)
 {
     _decoratedCatalog = catalog;
     _catalog.Catalogs.Add(_decoratedCatalog);
     _catalog.Changing += (s, e) => { OnChanging(e); };
     LoadTypeLocators(_genericTypes);
 }
 public MefUnityContainerExtension(ComposablePartCatalog catalog, bool register, params ExportProvider[] providers)
 {
     Debug.Assert(catalog != null);
     m_Catalog = catalog;
     m_Register = register;
     m_Providers = providers;
 }
Example #5
0
        /// <summary>
        /// Initializes a new instance.
        /// </summary>
        /// <param name="parent"></param>
        /// <param name="scope"></param>
        public ScopeCatalog(ComposablePartCatalog parent, Scope scope)
            : base(parent, GetFilter(scope))
        {
            Contract.Requires<ArgumentNullException>(parent != null);

            this.scope = scope;
        }
		/// <summary>
		/// Initializes a new instance of the <see cref="WebPartsCatalog" /> class. Overloaded constructor allows caller to specify one or more assemblies and
		/// optionally MEF conventions for finding parts.
		/// </summary>
		/// <param name="assemblies">The assemblies.</param>
		/// <param name="reflectionContext">The reflection context.</param>
		public WebPartsCatalog(Assembly[] assemblies, ReflectionContext reflectionContext = null)
		{
			if (reflectionContext == null)
				reflectionContext = GetWebPartConventions();

			catalog = new AggregateCatalog(assemblies.Select(a => new AssemblyCatalog(a, reflectionContext)));
		}
        /// <summary>
        /// Initializes a new instance of the <see cref="CompositionScopeDefinition"/> class.
        /// </summary>
        /// <param name="catalog">The catalog.</param>
        /// <param name="children">The children.</param>
        public CompositionScopeDefinition(ComposablePartCatalog catalog, IEnumerable<CompositionScopeDefinition> children)
        {
            Requires.NotNull(catalog, "catalog");
            Requires.NullOrNotNullElements(children, "children");

            InitializeCompositionScopeDefinition(catalog, children, null);
        }
 public FilteredCatalog(ComposablePartCatalog inner,
                        Func<ComposablePartDefinition, bool> filter)
 {
     _inner = inner;
     _innerNotifyChange = inner as INotifyComposablePartCatalogChanged;
     _partsQuery = inner.Parts.Where(filter).AsQueryable();
 }
Example #9
0
        /// <summary>
        /// Initializes a new instance.
        /// </summary>
        /// <param name="xml"></param>
        /// <param name="catalog"></param>
        /// <param name="exports"></param>
        Document(
            Func<Document, XDocument> xml,
            ComposablePartCatalog catalog,
            ExportProvider exports)
        {
            Contract.Requires<ArgumentNullException>(xml != null);

            // configure composition
            this.configuration = GetConfiguration(catalog, exports);
            this.container = new CompositionContainer(configuration.HostCatalog, true, new CompositionContainer(configuration.GlobalCatalog, true, configuration.Exports));
            this.container.GetExportedValue<DocumentEnvironment>().SetHost(this);

            // required services
            this.invoker = container.GetExportedValue<IInvoker>();
            this.trace = container.GetExportedValue<ITraceService>();

            // initialize xml
            this.xml = xml(this);
            this.xml.AddAnnotation(this);

            // parallel initialization of common interfaces
            Parallel.ForEach(this.xml.DescendantNodesAndSelf(), i =>
            {
                Enumerable.Empty<object>()
                    .Concat(i.Interfaces<IOnInit>())
                    .Concat(i.Interfaces<IOnLoad>())
                    .ToLinkedList();
            });

            // initial invocation entry
            this.invoker.Invoke(() => { });
        }
 public IQueryable<ComposablePart> SelectParts(ComposablePartCatalog catalog)
 {
     var parts = from part in catalog.Parts
                 where part.ExportDefinitions.Any(d => d.ContractName == typeof(IOperatorsPackage).FullName)
                 select part.CreatePart();
     return parts;
 }
Example #11
0
    /// <summary>
    /// Initializes a new instance of the FilteredCatalog class with the specified underlying
    /// catalog and filter.
    /// </summary>
    public FilteredCatalog(ComposablePartCatalog inner,
		Expression<Func<ComposablePartDefinition, bool>> expression)
    {
        _inner = inner;
        _innerNotifyChange = inner as INotifyComposablePartCatalogChanged;
        _partsQuery = inner.Parts.Where(expression);
    }
Example #12
0
        public NetworkAwareCatalog(ComposablePartCatalog filteredCatalog)
        {
            _networkStatus = (NetworkInterface.GetIsNetworkAvailable()) ? "Online" : "Offline";
            NetworkChange.NetworkAvailabilityChanged += new NetworkAvailabilityChangedEventHandler(NetworkAvailabilityChanged);

            _filteredCatalog = filteredCatalog;
        }
Example #13
0
        internal CompositionService(ComposablePartCatalog composablePartCatalog)
        {
            Assumes.NotNull(composablePartCatalog);
            this._notifyCatalog = composablePartCatalog as INotifyComposablePartCatalogChanged;
            try
            {
                if(this._notifyCatalog != null)
                {
                    this._notifyCatalog.Changing += this.OnCatalogChanging;
                }

                var compositionOptions = CompositionOptions.DisableSilentRejection | CompositionOptions.IsThreadSafe | CompositionOptions.ExportCompositionService;
                var compositionContainer = new CompositionContainer(composablePartCatalog, compositionOptions);
    
                this._compositionContainer = compositionContainer;
            }
            catch
            {
                if(this._notifyCatalog != null)
                {
                    this._notifyCatalog.Changing -= this.OnCatalogChanging;
                }
                throw;
            }
        }
 /// <summary>
 /// Registers a MEF catalog within Unity container.
 /// </summary>
 /// <param name="unityContainer">Unity container instance.</param>
 /// <param name="catalog">MEF catalog to be registered.</param>
 /// <param name="isThreadSafe">Indicates if MEF should be thread safe.</param>
 public static void RegisterCatalog(this IUnityContainer unityContainer, ComposablePartCatalog catalog, bool isThreadSafe = false)
 {
     lock (unityContainer)
     {
         var compositionIntegration = EnableCompositionIntegration(unityContainer, isThreadSafe);
         compositionIntegration.Catalogs.Add(catalog);
     }
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="CompositionScopeDefinition"/> class.
        /// </summary>
        /// <param name="catalog">The catalog.</param>
        /// <param name="children">The children.</param>
        /// <param name="publicSurface">The exports that can be used to create new scopes.</param>
        public CompositionScopeDefinition(ComposablePartCatalog catalog, IEnumerable<CompositionScopeDefinition> children, IEnumerable<ExportDefinition> publicSurface)
        {
            Requires.NotNull(catalog, "catalog");
            Requires.NullOrNotNullElements(children, "children");
            Requires.NullOrNotNullElements(publicSurface, "publicSurface");

            InitializeCompositionScopeDefinition(catalog, children, publicSurface);
        }
        public ScopedContainerManager(ComposablePartCatalog rootCatalog)
        {
            if (rootCatalog == null) throw new ArgumentNullException("rootCatalog");

            _rootCatalog = rootCatalog;

            _container = new CompositionContainer(new FilteredCatalog(rootCatalog, def => GetAllWithinAppScope(def)), true);
        }
 public CatalogChangeProxy(ComposablePartCatalog originalCatalog,
     IEnumerable<ComposablePartDefinition> addedParts,
     IEnumerable<ComposablePartDefinition> removedParts)
 {
     this._originalCatalog = originalCatalog;
     this._addedParts = new List<ComposablePartDefinition>(addedParts);
     this._removedParts = new HashSet<ComposablePartDefinition>(removedParts);
 }
        public ForceFieldContainer(ComposablePartCatalog catalog, Configuration config)
            : base(catalog)
        {
            Guard.ArgumentIsNotNull(() => catalog, () => config);

            _config = config;
            _config.SetInnerContainer(this);
        }
Example #19
0
        public void Constructor3_ArrayWithNullAsCatalogsArgument_ShouldThrowArgument()
        {
            var catalogs = new ComposablePartCatalog[] { null };

            ExceptionAssert.ThrowsArgument<ArgumentException>("catalogs", () =>
            {
                new AggregateCatalog(catalogs);
            });
        }
 public InterceptingCatalog(ComposablePartCatalog interceptedCatalog, IExportedValueInterceptor valueInterceptor, IList<IExportHandler> handlers)
 {
     interceptedCatalog.ShouldNotBeNull("interceptedCatalog");
     valueInterceptor.ShouldNotBeNull("valueInterceptor)");
     _interceptedCatalog = interceptedCatalog;
     _valueInterceptor = valueInterceptor;
     _handlers = handlers;
     InitializeHandlers();
 }
        public static CompositionContainer Create(ComposablePartCatalog catalog)
        {
            var container = new CompositionContainer(new AggregateCatalog(catalog,
                new TypeCatalog(typeof(CompositionContainer))));

            container.ComposeExportedValue<CompositionContainer>(container);

            return container;
        }
 public CatalogContractInformationProvider(ComposablePartCatalog catalog)
 {
     _catalog = catalog;
     var changeableCatalog = _catalog as INotifyComposablePartCatalogChanged;
     if (changeableCatalog != null)
     {
         changeableCatalog.Changed +=new EventHandler<ComposablePartCatalogChangeEventArgs>(catalog_Changed);
     }
 }
Example #23
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ProxyCatalog"/> class.
        /// </summary>
        /// <param name="innerCatalog">The inner catalog.</param>
        public ProxyCatalog(ComposablePartCatalog innerCatalog)
        {
            this.innerCatalog = innerCatalog;
			parts = CreateFrom(this.innerCatalog);
			
            var notifyingCatalog = this.innerCatalog as INotifyComposablePartCatalogChanged;
            if(notifyingCatalog != null)
                notifyingCatalog.Changing += NotifyingCatalog_Changing;
        }
Example #24
0
 /// <summary>
 /// Creates a new instance of the <see cref="ComponentCatalog"/> class.
 /// </summary>
 /// <param name="innerCatalog"></param>
 public ComponentCatalog(ComposablePartCatalog innerCatalog)
     : base(new FilteringReflectionCatalog(innerCatalog)
     {
         PartFilter = part => part.PartType.AsComponent() != null,
         ExportFilter = export => export.ExportingType.AsComponent() != null
     })
 {
     base.PartMetadataDecorator = PartDecorator;
     base.ExportMetadataDecorator = ExportDecorator;
 }
 public DynamicProxyValueInterceptorContext()
 {
     var innerCatalog = new TypeCatalog(typeof(Customer));
     var interceptor = new FreezableInterceptor();
     interceptor.Freeze();
     var valueInterceptor = new DynamicProxyInterceptor(interceptor);
     Catalog = new InterceptingCatalog(innerCatalog, valueInterceptor);
     Container = new CompositionContainer(Catalog);
     Context();
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="WebApplicationCatalog"/> class.
        /// </summary>
        /// <param name="assemblies">The assemblies.</param>
        /// <param name="reflectionContext">The reflection context.</param>
        protected WebApplicationCatalog(IEnumerable<Assembly> assemblies, ReflectionContext reflectionContext = null)
        {
            if (!IsInitialized)
            {
                if (reflectionContext == null)
                    reflectionContext = DefineConventions();

                applicationCatalog = new AggregateCatalog(assemblies.Select(a => new AssemblyCatalog(a, reflectionContext)));
            }
        }
Example #27
0
        public IntegrationTests()
        {
            _catalog = new TypeCatalog(
                typeof(Foo), typeof(Bar), typeof(Biff), typeof(MissingMeta),
                typeof(WrongCreationPolicy), typeof(WrongTypeIdentity));

            _container = new CompositionContainer(_catalog);

            _analysis = new CompositionInfo(_catalog, _container);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="AggregateCatalog"/> class.
        /// </summary>
        /// <param name="backend">The backend.</param>
        /// <param name="environments">The environments.</param>
        public EnvironmentCatalog(ComposablePartCatalog backend, IEnumerable<string> environments)
        {
            if (environments == null)
                throw new ArgumentNullException("environment");
            if (backend == null)
                throw new ArgumentNullException("backend");

            _environments = new HashSet<string>(environments, StringComparer.Ordinal);
            _catalog = backend;
            this._partsQuery = this._catalog.Parts.AsQueryable();
        }
Example #29
0
 /// <summary>
 /// Initializes a new instance.
 /// </summary>
 /// <param name="catalog"></param>
 /// <param name="exports"></param>
 public CompositionConfiguration(
     ComposablePartCatalog catalog, 
     ExportProvider exports)
     : this(new ScopeCatalog(catalog, Scope.Global),
         new ScopeCatalog(catalog, Scope.Host),
         new ScopeCatalog(catalog, Scope.Object),
         exports)
 {
     Contract.Requires<ArgumentNullException>(catalog != null);
     Contract.Requires<ArgumentNullException>(exports != null);
 }
Example #30
0
		public EmbeddableDocumentStore NewDocumentStore(
			bool deleteDirectory = true,
			string requestedStorage = null,
			ComposablePartCatalog catalog = null,
			bool deleteDirectoryOnDispose = true)
		{
			path = Path.GetDirectoryName(Assembly.GetAssembly(typeof(DocumentStoreServerTests)).CodeBase);
			path = Path.Combine(path, "TestDb").Substring(6);

			string defaultStorageType = GetDefaultStorageType(requestedStorage);

			var documentStore = new EmbeddableDocumentStore
			{
				Configuration =
				{
					DefaultStorageTypeName = defaultStorageType,
					DataDirectory = path,
					RunInUnreliableYetFastModeThatIsNotSuitableForProduction = true,
					RunInMemory = false,
					Port = 8079
				}
			};

			if (catalog != null)
				documentStore.Configuration.Catalog.Catalogs.Add(catalog);

			try
			{
				ModifyStore(documentStore);
				ModifyConfiguration(documentStore.Configuration);

				if (deleteDirectory)
					IOExtensions.DeleteDirectory(path);

				documentStore.Initialize();

				CreateDefaultIndexes(documentStore);

				if (deleteDirectoryOnDispose)
					documentStore.Disposed += ClearDatabaseDirectory;

				return documentStore;
			}
			catch
			{
				// We must dispose of this object in exceptional cases, otherwise this test will break all the following tests.
				documentStore.Dispose();
				throw;
			}
			finally
			{
				stores.Add(documentStore);
			}
		}
Example #31
0
 public FilteredCatalog(ComposablePartCatalog sourceCatalog, Func <ComposablePartDefinition, bool> inclusiveFilter)
 {
     this.inclusiveFilter = inclusiveFilter;
     this.sourceCatalog   = sourceCatalog;
 }
Example #32
0
 private static CatalogExportProvider CreateCatalogExportProvider(ComposablePartCatalog catalog)
 {
     return(new CatalogExportProvider(catalog));
 }
Example #33
0
 public void AddCatalog(ComposablePartCatalog catalog)
 {
     this._catalog.Catalogs.Add(catalog);
 }
Example #34
0
 public MefDependencySolver(ComposablePartCatalog catalog)
 {
     _catalog = catalog;
 }
Example #35
0
 /// <summary>
 /// Initialise une nouvelle instance de la classe <see cref="TransientCompositionContainer"/>.
 /// </summary>
 /// <param name="catalog">Un catalogue fournissant des objets <see cref="System.ComponentModel.Composition.Primitives.Export"/> au conteneur.</param>
 /// <param name="providers">Un tableur de fournisseur d'exports.</param>
 public TransientCompositionContainer(ComposablePartCatalog catalog, params ExportProvider[] providers)
     : base(catalog, providers)
 {
 }
 public BuiltinFilteringCatalog(ComposablePartCatalog catalogToFilter) : base(catalogToFilter)
 {
 }
Example #37
0
 /// <summary>
 /// Initializes a new instance. By default no instances from <paramref name="source"/> are exposed.
 /// </summary>
 /// <param name="source"></param>
 public DynamicFilteredCatalog(ComposablePartCatalog source)
 {
     aggregate = new AggregateCatalog(filter = source.Filter(i => false));
 }
 public ViewModulesCatalog(ComposablePartCatalog inner, IPermissionsProvider permissionsProvider)
     : base(inner, part => part.ExportDefinitions.All(def => permissionsProvider.IsAllowed(def)))
        /// <summary>
        /// Registers a MEF catalog within Unity container.
        /// </summary>
        /// <param name="unityContainer">Unity container instance.</param>
        /// <param name="catalog">MEF catalog to be registered.</param>
        public static void RegisterCatalog(this IUnityContainer unityContainer, ComposablePartCatalog catalog)
        {
            EnsureUnityHasHolder(unityContainer);

            ExtensionHolders[unityContainer].Catalog.Catalogs.Add(catalog);
        }
Example #40
0
 public DesignTimeCatalog(ComposablePartCatalog inner)
 {
     _inner             = inner;
     _innerNotifyChange = inner as INotifyComposablePartCatalogChanged;
 }
Example #41
0
 public SelectionPriorityContainer(ComposablePartCatalog catalog)
     : base(catalog)
 {
 }
Example #42
0
        /// <summary>
        /// Creates a new Embeddable document store.
        /// </summary>
        /// <param name="runInMemory">Whatever the database should run purely in memory. When running in memory, nothing is written to disk and if the server is restarted all data will be lost.<br/>Default: <b>true</b></param>
        /// <param name="requestedStorage">What storage type to use (see: RavenDB Storage engines).<br/>Allowed values: <b>vornon</b>, <b>esent</b>.<br/>Default: <b>voron</b></param>
        /// <param name="catalog">Custom bundles that are not provided by RavenDb.</param>
        /// <param name="dataDir">The path for the database directory. Can use ~\ as the root, in which case the path will start from the server base directory. <br/>Default: <b>~\Data</b></param>
        /// <param name="enableAuthentication"></param>
        /// <param name="activeBundles">Semicolon separated list of bundles names, such as: 'Replication;Versioning'.<br/>Default: no bundles turned on.</param>
        /// <param name="port">The port to use when creating the http listener. Allowed: 1 - 65,536 or * (find first available port from 8079 and upward).<br/>Default: <b>8079</b></param>
        /// <param name="anonymousUserAccessMode">Determines what actions an anonymous user can do. Get - read only, All - read & write, None - allows access to only authenticated users, Admin - all (including administrative actions).<br/>Default: <b>Get</b></param>
        /// <param name="configureStore">An action delegate which allows you to configure the document store instance that is returned. eg. <code>configureStore: store => store.DefaultDatabase = "MasterDb"</code></param>
        /// <param name="databaseName">Name of the server that will show up on /admin/stats endpoint.</param>
        /// <param name="indexes">A collection of indexes to execute.</param>
        /// <param name="transformers">A collection of transformers to execute.</param>
        /// <param name="seedData">A collection of some fake data that will be automatically stored into the document store.</param>
        /// <remarks>Besides the document store being instantiated, it is also Initialized.<br/>Also, any indexes or transfomers that are provided, the process will not wait for them to be completed/not stale. You need to explicity call the <code>WaitForIndexing(..)</code> method.<br/>For further info, please goto: http://ravendb.net/docs/article-page/2.5/csharp/server/administration/configuration</remarks>
        /// <returns>A new instance of an EmbeddableDocumentStore.</returns>
        public EmbeddableDocumentStore NewDocumentStore(
            bool runInMemory              = true,
            string requestedStorage       = null,
            ComposablePartCatalog catalog = null,
            string dataDir            = null,
            bool enableAuthentication = false,
            string activeBundles      = null,
            int?port = null,
            AnonymousUserAccessMode anonymousUserAccessMode            = AnonymousUserAccessMode.Admin,
            Action <EmbeddableDocumentStore> configureStore            = null,
            [CallerMemberName] string databaseName                     = null,
            IEnumerable <AbstractIndexCreationTask> indexes            = null,
            IEnumerable <AbstractTransformerCreationTask> transformers = null,
            IEnumerable <IEnumerable> seedData = null)
        {
            databaseName = NormalizeDatabaseName(databaseName);

            var storageType   = GetDefaultStorageType(requestedStorage);
            var dataDirectory = dataDir ?? NewDataPath(databaseName);
            var documentStore = new EmbeddableDocumentStore
            {
                UseEmbeddedHttpServer = port.HasValue,
                Configuration         =
                {
                    DefaultStorageTypeName = storageType,
                    DataDirectory          = Path.Combine(dataDirectory, "System"),
                    RunInUnreliableYetFastModeThatIsNotSuitableForProduction = true,
                    RunInMemory             = storageType.Equals("esent", StringComparison.OrdinalIgnoreCase) == false && runInMemory,
                    Port                    = port ?? 8079,
                    AnonymousUserAccessMode = anonymousUserAccessMode,
                }
            };

            documentStore.Configuration.FileSystem.DataDirectory = Path.Combine(dataDirectory, "FileSystem");
            documentStore.Configuration.Encryption.UseFips       = SettingsHelper.UseFipsEncryptionAlgorithms;

            if (activeBundles != null)
            {
                documentStore.Configuration.Settings["Raven/ActiveBundles"] = activeBundles;
            }

            if (catalog != null)
            {
                documentStore.Configuration.Catalog.Catalogs.Add(catalog);
            }

            try
            {
                if (configureStore != null)
                {
                    configureStore(documentStore);
                }

                ModifyStore(documentStore);
                ModifyConfiguration(documentStore.Configuration);
                documentStore.Configuration.PostInit();
                documentStore.Initialize();

                if (enableAuthentication)
                {
                    EnableAuthentication(documentStore.SystemDatabase);
                }

                CreateDefaultIndexes(documentStore);

                if (indexes != null)
                {
                    ExecuteIndexes(indexes, documentStore);
                }

                if (transformers != null)
                {
                    ExecuteTransformers(transformers, documentStore);
                }

                if (seedData != null)
                {
                    StoreSeedData(seedData, documentStore);
                }

                return(documentStore);
            }
            catch
            {
                // We must dispose of this object in exceptional cases, otherwise this test will break all the following tests.
                documentStore.Dispose();
                throw;
            }
            finally
            {
                stores.Add(documentStore);
            }
        }
Example #43
0
 public static void AddCatalog(ComposablePartCatalog item)
 {
     catalogs.Add(item);
 }
Example #44
0
 public static ComposablePartCatalog CreateFiltered(ComposablePartCatalog catalog, Func <ComposablePartDefinition, bool> filter)
 {
     return(new FilteredCatalog(catalog, filter));
 }
Example #45
0
 protected IEnumerable <ITechnology> InitializeMEF(
     ComposablePartCatalog catalog)
 {
     using (CompositionContainer compositionContainer = new CompositionContainer(catalog, Array.Empty <ExportProvider>()))
         return((IEnumerable <ITechnology>)compositionContainer.GetExports <ITechnology>().Select <Lazy <ITechnology>, ITechnology>((Func <Lazy <ITechnology>, ITechnology>)(n => n.Value)).ToList <ITechnology>());
 }
 /// <summary>
 /// Initializes the catalog.
 /// </summary>
 public FilteringReflectionCatalog(ComposablePartCatalog innerCatalog)
 {
     this.innerCatalog = innerCatalog;
     this.PartFilter   = context => true;
     this.ExportFilter = context => true;
 }
Example #47
0
 public CustomCatalog(ComposablePartCatalog catalog)
 {
     _innerCatalog    = catalog;
     _partDefinitions = new Dictionary <ComposablePartDefinition, CustomComposablePartDefinition>();
 }
Example #48
0
 public MefUnityContainerExtension(ComposablePartCatalog catalog, params ExportProvider[] providers)
     : this(catalog, true, providers)
 {
 }
Example #49
0
 public TestComposition()
 {
     PartCatalog    = GetAssemblyCatalog(GetTypes());
     ExportProvider = new CompositionContainer(PartCatalog, isThreadSafe: true);
     MinimumCatalog = new AggregateCatalog(new TypeCatalog(GetRoslynTypes()), GetAssemblyCatalog(GetVisualStudioTypes()));
 }
Example #50
0
 public static string GetDisplayName(this ComposablePartCatalog catalog)
 {
     return(GetDisplayNameCore(catalog));
 }
Example #51
0
 public PlugInContainer(ComposablePartCatalog catalog)
     : this()
 {
     AddCatalog(catalog);
 }
Example #52
0
 /// <summary>
 /// 初始化 <see cref="SingleCompositionContainer"/> 类的新实例。
 /// </summary>
 /// <param name="catalog">对象的组合目录。</param>
 /// <param name="providers">附加一组 <see cref="ExportProvider"/> 对象。</param>
 public SingleCompositionContainer(ComposablePartCatalog catalog, params ExportProvider[] providers)
     : base(catalog, exports => exports.FirstOrDefault(), providers)
 {
 }
Example #53
0
 private ComposablePartCatalog ScopeCatalog(ComposablePartCatalog catalog, string scope)
 {
     return(CatalogFactory.CreateFiltered(catalog,
                                          partDef => partDef.Metadata.ContainsKey("Scope") &&
                                          partDef.Metadata["Scope"].ToString() == scope));
 }