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

Injecting to referenced assemblies #1

Closed
Sarvesh-Gupta opened this issue Oct 26, 2017 · 2 comments
Closed

Injecting to referenced assemblies #1

Sarvesh-Gupta opened this issue Oct 26, 2017 · 2 comments

Comments

@Sarvesh-Gupta
Copy link

Does this approach will inject dependencies to referenced assemblies. For example if Greeter also was expecting a dependency, will it work?

@justinkneff
Copy link

justinkneff commented Jan 12, 2018

So long as you register the additional Interface and Implementation in the RegisterServices method of the InjectConfiguration.cs

private void RegisterServices(IServiceCollection services)
{
   services.AddScoped<IGreeter, Greeter>();
   services.AddScoped<IAdditionalInterface, AdditionalImplementation>();
}

Where you have an Interface
public Interface IAdditionalInterface { ... }
and the implementation is
public class AdditionalImplementation : IAdditionalInterface { ... }

Just keep in mind the goal of Azure Functions on a Consumption Plan are to be light weight/nano-service and each interface you register but don't use still eats up memory and processing.

@BorisWilhelms
Copy link
Owner

Yes, it will work, as long as all dependencies of Greeter are also registered.

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

3 participants