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

Registering components using convention doesn't seem to promote components to proxied when adding interceptors #602

Open
vengefire opened this issue Aug 19, 2021 · 0 comments

Comments

@vengefire
Copy link

vengefire commented Aug 19, 2021

I am trying to add registrations via convention as per the following in a .Net 5 - API Project:

UserDomainManager <- IUserDomainManager <- IDomainManager

// Registration by convention instruction
container.Register(
                Classes.FromAssemblyContaining(typeof(UserDomainManager))
                    .BasedOn(typeof(IDomainManager))
                    .WithServiceDefaultInterfaces()
                    .Configure(registration => registration.Interceptors(InterceptorReference.ForKey("LogAspect"))));

// Explicit registration instruction
container.Register(Component.For<IUserDomainManager>().ImplementedBy<UserDomainManager>().LifestyleTransient().Interceptors(InterceptorReference.ForKey("LogAspect")).First);

EDIT : More detail.

The service-component pairs are being registered and injected correctly, however the backing components are not proxied and obviously the interceptor isn't called.

If I change this to an explicit registration specifying the types involved, then the proxy and interceptor functions as expected.

I'd be very happy if I was just too tired to see the obvious thing I've done wrong here with the registration, but any other ideas or suggestions would be welcome. I don't mind explicitly registering every service but I would very much like to be able to use the convention method when it was appropriate and would save time and boring boilerplate code.

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