Advertisement
Guest User

Untitled

a guest
May 21st, 2019
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. using Microsoft.Azure.Functions.Extensions.DependencyInjection;
  2. using Microsoft.Extensions.DependencyInjection;
  3.  
  4. [assembly: FunctionsStartup(typeof(AzureFunctionAppWithDIAndScrutor.Startup))]
  5.  
  6. namespace AzureFunctionAppWithDIAndScrutor
  7. {
  8. public class Startup : FunctionsStartup
  9. {
  10. public override void Configure(IFunctionsHostBuilder builder)
  11. {
  12. // builder.Services.AddSingleton<ISomeService, SomeService>();
  13.  
  14. builder.Services.Scan(scan => scan
  15. .FromAssemblyOf<ISomeService>()
  16. .AddClasses(classes => classes.AssignableTo<ISomeService>())
  17. .AsImplementedInterfaces()
  18. .WithSingletonLifetime());
  19.  
  20. builder.Services.Decorate<ISomeService, SimpleDecorator>();
  21.  
  22. }
  23. }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement