A new version of Azure Functions was just released, called 1.0.19. While there are quite some changes in this release, like the fact that Function Apps must have exactly one single language and WebJobs had been updated to 3.0.0-beta8, there are some breaking changes. For complete information about the changes see the announcement.
Azure Functions Version 1.0.19 comes with some breaking changes. Extensions cannot be created like they had been before. Have a look at these links:
- Breaking change in ExtensionConfigContext
- Subtle differences in DI between WebJobs.Script.WebHost and Microsoft.Azure.WebJobs/Microsoft.Extensions.DependencyInjection
As AutofacOnFunction relies on the ExtensionConfigContext, there was some stuff to do. Actually, it was possible to fix all breaking changes in the AutofacOnFunctions nuget package itself. While these fixes had been applied, I just introduced a small feature that had been requested by community.
Autofac allows for named services. AutofacOnFunctions had been enhanced to support named services in most initutive way. Actually there are only two steps to do.
First register your services by name.
[pastacode lang=”java” user=”holgerleichsenring” repos=”autofaconfunctions” path_id=”AutofacOnFunctions.Samples.NetStandard/Services/Modules/ServicesModule.cs” revision=”” highlight=”” lines=”” provider=”github”/]
Use the inject atttribute to specify the named instance:
[pastacode lang=”java” user=”holgerleichsenring” repos=”autofaconfunctions” path_id=”AutofacOnFunctions.Samples.NetStandard/Services/Functions/Function2.cs” revision=”” highlight=”” lines=”” provider=”github”/]