Breaking change in ExtensionConfigContext
See original GitHub issueAs noted here a lot of dependency injection stuff is build that relies on getting the JobHostConfiguration
from the ExtensionConfigContext
. With the new beta8 package the Config is gone. This is the old beta5 code:
public class ExtensionConfigContext : FluentConverterRules<Attribute, ExtensionConfigContext>
{
public ExtensionConfigContext();
public JobHostConfiguration Config { get; set; }
public FluentBindingRule<TAttribute> AddBindingRule<TAttribute>() where TAttribute : Attribute;
[Obsolete("preview")]
public Uri GetWebhookHandler();
}
Now we are not able to build an Inject binding to inject certain dependencies into our functions. Like we did before:
public class InjectConfiguration : IExtensionConfigProvider
{
public void Initialize(ExtensionConfigContext context)
{
var rule = context
.AddBindingRule<InjectAttribute>()
.Bind(new InjectBindingProvider());
var registry = context.Config.GetService<IExtensionRegistry>();
var filter = new ScopeCleanupFilter();
registry.RegisterExtension(typeof(IFunctionInvocationFilter), filter);
registry.RegisterExtension(typeof(IFunctionExceptionFilter), filter);
}
}
Do you have any alternatives for dependency injection? And if so please show an example.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:7
- Comments:36 (1 by maintainers)
Top Results From Across the Web
Azure Functions v2 Breaking Change for custom bindings
However, your CustomBindings will be broken. I'd like to share some simple step how to migrate your current Custom Bindings to adopt the...
Read more >Named services support, fixes for breaking changes
Breaking change in ExtensionConfigContext · Subtle differences in DI between WebJobs.Script.WebHost and Microsoft.Azure.WebJobs/Microsoft.
Read more >Azure Functions 2.0 extensibility - overview
Information about Azure Functions 2.0 extensibility are available, but scattered. This post attempts to gather the key aspects.
Read more >Versioning in Durable Functions (Azure Functions)
The most fail-proof way to ensure that breaking changes are deployed safely is by deploying them side-by-side with your older versions. This can ......
Read more >Calling Azure Function calls fail with "Function host is not ...
The message with it is: Repository has more than 10 non-decryptable secrets backups (host). I unfortunately have no idea what that means. Any ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I have published an example in this repository: https://github.com/DibranMulder/azure-functions-v2-dependency-injection