addscoped in .net core code example

Example 1: register all services microsoft .net core dependency injection container

service.RegisterAssemblyPublicNonGenericClasses(… your assembly ref goes here …)
.Where(x => x.Name.EndsWith(“Service”))  //optional
.IgnoreThisInterface()     //optional
.AsPublicImplementedInterfaces(ServiceLifetime.Scoped);

Example 2: servicecollection addsingleton vs addtransient

//ref https://stackoverflow.com/questions/38138100/addtransient-addscoped-and-addsingleton-services-differences

Tags:

Misc Example