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

Combine assembly scanning with named service #581

Open
Prev-I opened this issue Dec 28, 2022 · 0 comments
Open

Combine assembly scanning with named service #581

Prev-I opened this issue Dec 28, 2022 · 0 comments

Comments

@Prev-I
Copy link

Prev-I commented Dec 28, 2022

I would like to mark all service class with an annotation (or a specific property) containing the name to be used in Registration when loading from assembly.

[AutoWireName("GET_ALL_USERS")]
public class GetAllUsersQueryHandler : IRequestHandler

Then in startup.cs when registering by assembly, how can I Add the custom logic for service name?

container.RegisterAssembly(typeof(IRequestHandler).Assembly, 
() => new PerContainerLifetime(), 
(serviceType, implementingType) => serviceType.NameSpace == "SomeNamespace", (serviceType, implementingType) => "Provide custom service name here");
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

1 participant