Skip to content

Instantly share code, notes, and snippets.

@msajid
Last active May 10, 2019 23:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save msajid/b3b7d9224856caed385369d9d30c6b8f to your computer and use it in GitHub Desktop.
Save msajid/b3b7d9224856caed385369d9d30c6b8f to your computer and use it in GitHub Desktop.
using Microsoft.Azure.Functions.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection;
[assembly: FunctionsStartup(typeof(AzureFunctionAppWithDIAndScrutor.Startup))]
namespace AzureFunctionAppWithDIAndScrutor
{
public class Startup : FunctionsStartup
{
public override void Configure(IFunctionsHostBuilder builder)
{
// builder.Services.AddSingleton<ISomeService, SomeService>();
builder.Services.Scan(scan => scan
.FromAssemblyOf<ISomeService>()
.AddClasses(classes => classes.AssignableTo<ISomeService>())
.AsImplementedInterfaces()
.WithSingletonLifetime());
builder.Services.Decorate<ISomeService, SimpleDecorator>();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment