Monday, 12 February 2024

Lifetimes Dependency Injection

 There are 3 types of lifetimes supported by ASP.NET Core for the dependency injection,

1.Transient Service

2.Scoped Service

3.Singleton Service

Let’s have a look in depth at how it works


transient -each action one object will be create 

not the data will be passed

external utiltiy ofn previous t

scoped - keep the session through the request

registion reportiry 


shopping cart- scope

order it send the mail - transient (not need any data)

No comments:

Post a Comment