Chapter 5 – Implementing Design Patterns – .NET Core

  1. If you are not sure what type of service lifetime to use, what type is it best to register a class as? Why?

Transient lifetime services are created each time they are requested. The majority of classes should be lightweight, stateless services, so this is the best service lifetime to use.

  1. In .NET Core ASP .NET solutions, a scope is defined per web request or per session?

A scope is per web request (connection).

  1. Does registering a class as a Singleton in the .NET Core DI framework make it thread-safe?

No, the framework will provide the same instance for subsequent requests, but does not make a class thread-safe.

  1. Is it true that the .NET Core DI framework can only be replaced with other Microsoft-supplied DI frameworks?

Yes, there are many DI frameworks that can be used instead of the native DI framework.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.144.36.141