December 2019
Intermediate to advanced
510 pages
11h 33m
English
We can register the IPaymentService interface in ConfigureServices in the Startup class by adding the following code:
public class Startup { // ... public void ConfigureServices(IServiceCollection services) { services .AddTransient<IPaymentService, PaymentService>() .AddControllers(); } // ... }
The preceding code shows a simple instantiation of a service using the ASP.NET Core container. I've omitted some parts of the Startup class in order to make the code more readable. The runtime executes the services.AddTransient<IPaymentService, PaymentService>() method in order to map the IPaymentService interface with the concrete implementation that was described in the ...
Read now
Unlock full access