Skip to content

A .NET export container and manager designed to simplify access to exported types. Well suited for plugin integration.

License

Notifications You must be signed in to change notification settings

TagBites/TagBites.ComponentModel.Composition

Repository files navigation

TagBites.ComponentModel.Composition

Nuget License

A .NET export container and manager designed to simplify access to exported types. Well suited for plugin integration. Supports caching to speed up application startup, eliminating the necessity to load and analyze all assemblies.

Example

internal static class Program
{
    public static ExportComponentManager ComponentManager { get; set; }


    static void Main()
    {
        // Load
        ComponentManager = new ExportComponentManager();

        foreach (var assembly in AppDomain.CurrentDomain.GetAssemblies())
            ComponentManager.LoadAssembly(assembly);

        // Test
        foreach (var testInstance in ComponentManager.GetExportInstances<ITest>())
            Console.WriteLine(testInstance.GetType().Name);

        // Output:
        // Test1
        // Test2
    }
}

public interface ITest
{ }

[Export(typeof(ITest))]
internal class Test1 : ITest
{ }

[Export(typeof(ITest))]
internal class Test2 : ITest
{ }

About

A .NET export container and manager designed to simplify access to exported types. Well suited for plugin integration.

Resources

License

Stars

Watchers

Forks

Languages