We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
public class ManagedExtensibility { private CompositionContainer? container; public void Initialize() { try { //new DirectoryCatalog("."); var catalog = new AggregateCatalog(); catalog.Catalogs.Add(new AssemblyCatalog(typeof(ManagedExtensibility).Assembly)); container = new CompositionContainer(catalog); var helper = new SnippetProviderHelper(); container.ComposeParts(helper); } catch (CompositionException compositionException) { Console.WriteLine(compositionException.ToString()); } } } class SnippetProviderHelper { [ImportMany] public IEnumerable<Lazy<ISnippetProvider, IConfigChangeTrackingSnippetProviderMetadata>> Providers { get; set; } } public interface IConfigChangeTrackingSnippetProviderMetadata { string ConfigurationKey { get; } Type ConfigurationType { get; } bool IsNullConfigurationEnabled { get; } } [MetadataAttribute] [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)] public sealed class ConfigChangeTrackingSnippetProviderAttribute<T> : ExportAttribute, IConfigChangeTrackingSnippetProviderMetadata { public string ConfigurationKey { get; set; } public Type ConfigurationType { get; set; } public bool IsNullConfigurationEnabled { get; set; } public ConfigChangeTrackingSnippetProviderAttribute(string configurationKey, bool isNullConfigurationEnabled = false) : base(typeof(ISnippetProvider)) { ConfigurationKey = configurationKey; ConfigurationType = typeof(T); IsNullConfigurationEnabled = isNullConfigurationEnabled; } } [ConfigChangeTrackingSnippetProvider<GitHubConfiguration>("GitHub")] public class TestSnippetProvider : ISnippetProvider { public Task InitializeAsync(SnippetProviderContext context) { throw new NotImplementedException(); } public Task UpdateAsync(SnippetProviderContext context) { throw new NotImplementedException(); } }
<PackageReference Include="System.ComponentModel.Composition" Version="7.0.0" />
The text was updated successfully, but these errors were encountered:
No branches or pull requests
The text was updated successfully, but these errors were encountered: