Skip to content
New issue

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

Assembly scanning functionality #323

Open
Kaliumhexacyanoferrat opened this issue Oct 13, 2022 · 0 comments
Open

Assembly scanning functionality #323

Kaliumhexacyanoferrat opened this issue Oct 13, 2022 · 0 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@Kaliumhexacyanoferrat
Copy link
Owner

As a developer, I would like to automatically configure a handler based on the types discovered in a certain assembly or plugin directory, so that I do not need to wire everything by myself.

Note, that this requirement somehow violates the idea of reducing autowire magic by specifying all dependencies manually. Nevertheless, for some use cases (such as plugins) or bigger projects, this could be useful.

Idea via @ukionik: https://github.com/ukionik/UkiRggRandomizer/blob/ddabbbe33ff3865ba08a3333138e30bd69d13082/UkiRandomizer/UkiRandomizer/Core/ConfigExtensions.cs#L30

Example

var api = Scanner.Build<LayoutBuilder>()
                 .From(Assembly.GetExecutingAssembly()) // or IResource or IResourceTree
                 .Filter<MyAttribute>()
                 .With((builder, assembly, type) => builder.AddService(...));

Acceptance criteria

  • The functionality is provided within a new module (e.g. GenHTTP.Modules.Scanner)
  • Any handler can be built (not just layouts)
  • Discovered types can be filtered (e.g. by attribute)
  • The lambda may also discard a type if needed (e.g. by returning null)
  • The scanner does not detect changes automatically (but probably can be triggered to re-scan if needed)
  • The resulting builder can be further adjusted as needed (e.g. .Configure(builder => builder.Index(...)))
  • There are acceptance tests covering the functionality
@Kaliumhexacyanoferrat Kaliumhexacyanoferrat added enhancement New feature or request good first issue Good for newcomers labels Oct 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

1 participant