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

Use generic method from ServiceDescriptor #139

Open
Cologler opened this issue Jun 22, 2024 · 1 comment
Open

Use generic method from ServiceDescriptor #139

Cologler opened this issue Jun 22, 2024 · 1 comment

Comments

@Cologler
Copy link

Currently, Injectio generated ServiceDescriptor.Describe for each service:

ServiceCollectionDescriptorExtensions.TryAdd(
    serviceCollection,
    ServiceDescriptor.Describe(
        typeof(TService),
        typeof(TImplementation), 
        ServiceLifetime.Scoped
    )
);

Switching to ServiceDescriptor.Scoped<TService, TImplementation> where TImplementation : TService can detect type errors at compile time.

@pwelter34
Copy link
Member

This won't work for open generics registration

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

No branches or pull requests

2 participants