{"id":25127876,"url":"https://github.com/remora/remora.plugins","last_synced_at":"2025-04-23T14:36:13.342Z","repository":{"id":54885935,"uuid":"429564878","full_name":"Remora/Remora.Plugins","owner":"Remora","description":"A simple, dynamic plugin system for .NET","archived":false,"fork":false,"pushed_at":"2025-02-13T13:06:54.000Z","size":116,"stargazers_count":3,"open_issues_count":4,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-14T19:17:15.542Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Remora.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-11-18T20:07:04.000Z","updated_at":"2025-02-13T13:06:58.000Z","dependencies_parsed_at":"2024-03-31T13:30:29.308Z","dependency_job_id":"b61a6caf-1e90-45ab-a7af-bb4651cdc7d4","html_url":"https://github.com/Remora/Remora.Plugins","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Remora%2FRemora.Plugins","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Remora%2FRemora.Plugins/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Remora%2FRemora.Plugins/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Remora%2FRemora.Plugins/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Remora","download_url":"https://codeload.github.com/Remora/Remora.Plugins/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250453446,"owners_count":21433203,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-02-08T11:19:41.111Z","updated_at":"2025-04-23T14:36:13.324Z","avatar_url":"https://github.com/Remora.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"Remora.Plugins\n==============\n\nRemora.Plugins is a simple plugin system for .NET, providing a dynamic pluggable\nframework for your applications. In short, class libraries can be written as \nstandalone packages and loaded at runtime as integrated parts of your \napplication, allowing loose coupling and easily swappable components. The plugin \nsystem is designed around Microsoft's dependency injection framework.\n\n## Usage\nCreating a plugin is as simple as creating a class library project, and \nannotating the assembly with an attribute denoting the type used as a plugin \ndescriptor. The descriptor acts as the entry point of the plugin, as well as an\nencapsulation point for information about it.\n\nGenerally, plugins should only reference Remora.Plugins.Abstractions, while the\nmain application should reference and use Remora.Plugins.\n\n```c#\n[assembly: RemoraPlugin(typeof(MyPlugin))]\n\npublic sealed class MyPlugin : PluginDescriptor\n{\n    /// \u003cinheritdoc /\u003e\n    public override string Name =\u003e \"My Plugin\";\n\n    /// \u003cinheritdoc /\u003e\n    public override string Description =\u003e \"My plugin that does a thing.\";\n\n    /// \u003cinheritdoc/\u003e\n    public override Result ConfigureServices(IServiceCollection serviceCollection)\n    {\n        serviceCollection\n            .AddScoped\u003cMyService\u003e();\n\n        return Result.FromSuccess();\n    }\n\n    /// \u003cinheritdoc /\u003e\n    public override async ValueTask\u003cResult\u003e InitializeAsync(IServiceProvider serviceProvider)\n    {\n        var myService = serviceProvider.GetRequiredService\u003cMyService\u003e();\n        var doThing = await myService.DoTheThingAsync();\n        if (!doThing.IsSuccess)\n        {\n            return doThing;\n        }\n\n        return Result.FromSuccess();\n    }\n}\n```\n\nLoading plugins in your application is equally simple. The example below is\nperhaps a little convoluted, but shows the flexibility of the system.\n\n```c#\nvar pluginService = new PluginService();\n\nvar serviceCollection = new ServiceCollection()\n    .AddSingleton(pluginService);\n\nvar pluginTree = pluginService.LoadPluginTree();\nvar configurePlugins = pluginTree.ConfigureServices(serviceCollection);\nif (!configurePlugins.IsSuccess)\n{\n    // check configurePlugins.Error to figure out why\n    return;\n}\n\n_services = serviceCollection.BuildServiceProvider();\n\nvar initializePlugins = await pluginTree.InitializeAsync(_services, ct);\nif (!initializePlugins.IsSuccess)\n{\n    // check initializePlugins.Error to figure out why\n    return;\n}\n\nvar migratePlugins = await pluginTree.MigrateAsync(_services, ct);\nif (!migratePlugins.IsSuccess)\n{\n    // check migratePlugins.Error to figure out why\n    return;\n}\n\n```\n\nPlugins should be designed in such a way that a registration or initialization \nfailure does not corrupt the application.\n\n## Building\nThe library does not require anything out of the ordinary to compile.\n\n```bash\ncd $SOLUTION_DIR\ndotnet build\ndotnet pack -c Release\n```\n\n## Downloading\nGet it on [NuGet][1].\n\n\n[1]: https://www.nuget.org/packages/Remora.Plugins/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fremora%2Fremora.plugins","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fremora%2Fremora.plugins","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fremora%2Fremora.plugins/lists"}