|
1 | 1 | # Autofac On Functions
|
2 |
| -Azure Function Autofac Integration |
| 2 | +Azure Function Autofac Integration, now version 1 available in nuget! |
3 | 3 |
|
4 | 4 | For a comprehensive explanation have a look at
|
5 | 5 |
|
6 | 6 | - [codingsoul: azure functions dependency injection with autofac](http://codingsoul.de/2018/01/19/azure-function-dependency-injection-with-autofac/)
|
7 | 7 | - [codingsoul: azure functions dependency injection with autofac nuget package](http://codingsoul.de/2018/06/12/azure-functions-dependency-injection-autofac-on-functions-nuget-package/)
|
| 8 | +- [codingsoul: named services, fixes for breaking changes](http://codingsoul.de/2018/09/11/autofaconfunctions-named-services-support-fixes-for-breaking-changes/) |
| 9 | +- [codingsoul: autofaconfunctions version 1 released](http://codingsoul.de/2018/09/24/autofaconfunctions-version-1-released/) |
8 | 10 |
|
9 |
| -Actually the current library and the nuget package only work on .net core. .net Framework support for Azure Functions version since 1.0.19 will follow. |
| 11 | +# Environment |
| 12 | +Current library supports net framework and net standard since Microsoft.Net.Sdk.Functions version 1.0.21. For that version Azure Functions V2 is necessary. If you want to work with former version of the sdk, have a look onto the [archive](https://github.com/holgerleichsenring/AutofacOnFunctions/tree/master/archive/). |
10 | 13 |
|
11 |
| -In sources there are two samples available that you can just use, when you don't want to use the nuget package or you want to work with the old V1 version of Azure Functions: |
12 |
| -- Azure Functions V1 with .net framework. |
13 |
| -- Azure Functions V2 with dot net standard. |
14 |
| - |
15 |
| -It doesn't matter which sample, the procedure how to use dependency injection is identical. |
| 14 | +# Paradigm |
| 15 | +It doesn't matter with version of dotnet is going to be used, dependency injection paradigm is done completely identical. The code probably need some different references for implementing the function itself due to microsoft.net.sdk.functions implementation in certain versions. |
16 | 16 |
|
17 | 17 | # Goal
|
18 | 18 | Azure functions are by design static. Allow for dependency injection within Azure function with Autofac. The extensible nature of Azure Functions allow for attribute based dependency injection implementation. The attribute is called "Inject". Just add it as a parameter to your function combined with the type and name of the service parameter.
|
@@ -63,8 +63,13 @@ The bootstrapper implementations will be read and autofac will be configured whe
|
63 | 63 |
|
64 | 64 | # Breaking Changes
|
65 | 65 |
|
| 66 | +## Microsoft.net.sdk.function version 1.0.19 |
66 | 67 | As version 1.0.19 of Azure Functions made changes to the procedure of initialization necessary, the former used ServiceLocator is not available anymore. Anyway you should not use a direct reference to an Autofac IContainer reference anyway. If you need to resolve services on the fly, just inject IObjectResolver to your class.
|
67 | 68 |
|
| 69 | +## Microsoft.net.sdk.function version 1.0.21 |
| 70 | +Version 1.0.19 references WebJobs Azure Functions made changes to the procedure of initialization necessary, the former used ServiceLocator is not available anymore. Anyway you should not use a direct reference to an Autofac IContainer reference anyway. If you need to resolve services on the fly, just inject IObjectResolver to your class. |
| 71 | + |
| 72 | + |
68 | 73 | # Named Services
|
69 | 74 | 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.
|
70 | 75 |
|
@@ -98,7 +103,8 @@ public static class Function2
|
98 | 103 | }
|
99 | 104 | ```
|
100 | 105 |
|
101 |
| -Full sample is available |
102 |
| -[AutofacOnFunctions net framework sample](https://github.com/holgerleichsenring/AutofacOnFunctions/tree/master/AutofacOnFunctions/AutofacOnFunctions.Samples.NetFramework) |
103 |
| -[AutofacOnFunctions net standard sample](https://github.com/holgerleichsenring/AutofacOnFunctions/tree/master/AutofacOnFunctions/AutofacOnFunctions.Samples.NetStandard) |
| 106 | +Full sample is available |
| 107 | + |
| 108 | +- [net standard](https://github.com/holgerleichsenring/AutofacOnFunctions/tree/master/AutofacOnFunctions/AutofacOnFunctions.Samples.NetStandard) |
| 109 | +- [net framework](https://github.com/holgerleichsenring/AutofacOnFunctions/tree/master/AutofacOnFunctions/AutofacOnFunctions.Samples.NetFramework) |
104 | 110 |
|
0 commit comments