Overview

Service Lifetimes and Registration Options

Transient

services.AddTransient<IEmailSender, AuthMessageSender>();
services.AddTransient<ISmsSender, AuthMessageSender>();

Scoped

services.AddScoped<IMyDependency, MyDependency>();

Singleton

services.AddSingleton<IOperationSingleton, Operation>();
services.AddSingleton<IOperationSingletonInstance>(new Operation(Guid.Empty));