Skip to content

Instantly share code, notes, and snippets.

@alimozdemir
Created May 30, 2020 11:59
Show Gist options
  • Save alimozdemir/9daccfe20c31d1da255718c33560d0fb to your computer and use it in GitHub Desktop.
Save alimozdemir/9daccfe20c31d1da255718c33560d0fb to your computer and use it in GitHub Desktop.
public void ConfigureServices(IServiceCollection services)
{
...
services.Scan(i =>
i.FromCallingAssembly()
.InjectableAttributes()
);
/* Or */
services.Scan(i =>
i.FromCallingAssembly()
.InjectableAttribute(ServiceLifetime.Transient)
.InjectableAttribute(ServiceLifetime.Scoped)
.InjectableAttribute(ServiceLifetime.Singleton)
);
...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment