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

[Spec] Use explicit registration #26

Closed
Tracked by #10
StephaneDelcroix opened this issue May 19, 2020 · 1 comment
Closed
Tracked by #10

[Spec] Use explicit registration #26

StephaneDelcroix opened this issue May 19, 2020 · 1 comment
Assignees

Comments

@StephaneDelcroix
Copy link
Contributor

Description

Use explicit registration, or avoid registration (like for slim renderers) instead of scanning all assemblies for assembly attributes for renderers, image handlers, stylepropery, dependency serivces, fonts, ...

As those need to be registered with extra information, the most portable way is to provide a service that you'd acquire on the IServiceCollection, then add the handlers to the service

No API provided at this time, as this covers multiple scenarios

Difficulty :low

@rmarinho
Copy link
Member

rmarinho commented Mar 24, 2021

the current proposed api is IAppHostBuilder will provider ways to register delegates that allow to register handlers , fonts or other things

public interface IAppHostBuilder : IHostBuilder
{
	IAppHostBuilder ConfigureHandlers(Action<HostBuilderContext, IServiceCollection> configureDelegate);
	IAppHostBuilder ConfigureFonts(Action<HostBuilderContext, IFontCollection> configureDelegate);
	IAppHostBuilder ConfigureImageSources(Action<HostBuilderContext, IImageCollection> configureDelegate);
}

To get the services the handler with expose a IServiceProvider

 handler.Services.GetRequiredService<IFontManager>();

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants