Skip to content

Implementation of Dependency Injection For Azure Function(Actual for WebJobs.Sdk.Extension ver. 3.0.0-beta8)

Notifications You must be signed in to change notification settings

ryanspletzer/DependencyInjectionAzureFunction

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Dependency Injection based on Indigo.Functions and ielcoro's issues answear

Use [Inject] attribute to inject all your dependencies in Azure Function declaration.

[FunctionName("Example")]
public static IActionResult Run(
    [HttpTrigger("GET")] HttpRequest request,
    [Inject] IInjectService injectInstance)
{
    ...
} 

Register your dependencies

For register your dependencies edit DependencyConfiguration

namespace Dependency_Injection
{
    public class DependencyConfiguration : IDependencyConfiguration
    {
        public void ConfigureServices(IServiceCollection services)
        {
            //Register dependencies there : 
            services.AddSingleton<IInjectService,InjectService>();
        }
    }
}

About

Implementation of Dependency Injection For Azure Function(Actual for WebJobs.Sdk.Extension ver. 3.0.0-beta8)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 100.0%