BorisWilhelms / azure-function-dependency-injection

Dependency Injection for Azure Functions v2
https://blog.wille-zone.de/
MIT License
145 stars 45 forks source link

Dependency Injection built in to Azure Functions #37

Open justinkneff opened 5 years ago

justinkneff commented 5 years ago

Microsoft released Dependency Injection functionality recently which is built on top of the ASP.NET Core Dependency Injection Features. What advantages and disadvantages does providing this solution using Attributes provide their functionality does not?

Is one or the other better performing? Is this faster cold boot? Is there functionality missing/provided by the other? What does compatibility look like with different IoC Containers, or package dependencies?

http://aka.ms/functions-di-docs

juliusl commented 5 years ago

One thing I've noticed is that this package has an [Inject] attribute which let's you inject the dependency directly into the parameter of the function.

The official DI implementation you have to inject it into a constructor which means that you can't have a static class/function.

Unless I'm missing something, but from that link there wasn't any usage examples so I'm going by: https://github.com/Azure/azure-functions-dotnet-extensions/tree/master/src/samples/DependencyInjection

rasmuschristensen commented 5 years ago

I just blogged about how to do setup and consume with the new bits and pieces https://blog.rasmustc.com/azure-functions-dependency-injection/