In this video, I have misspoken a couple of times: At 05:10 I mentioned "three different classes", which should have been "three different objects" At 10:47 I mentioned "unmanaged method" which should have been "unmanaged objects"
@SIDRA NOOR, thanks for watching! My blog site URL is dotnetcorecentral.com/, though I do not have this captured in my blog yet, I have other topics there if you want to check out.
Thank you ! Question: In .net core DI, we register Transient, Singleton, Scoped. Creating transient and scoped isn't adding additional burden on GC? though singleton is not good option either but this really confuse me, can you please answer if you can?
@Saurabh Chauhan, thanks for watching the video! Singleton is not necessarily a bad thing if it is done through DI, the reason the singleton design pattern was drawn upon was because of the fact that it was harder to test. But if you use it through DI, that argument is not valid anymore. There are definitely cases for using a singleton, especially if there is no state managed inside the object. Now in terms of transient and scoped usage, well technically they might cause GC to run more often compared to everything being singleton, but there are cases for using these as well. I will not be too concerned about GC running multiple times, especially in the days of microservices where services are small. But if you are using a monolithic application, there should be some consideration given for this situation. In which case, you should debate about which all classes make sense making singleton vs not. Let me know if it makes sense. Thanks
@@DotNetCoreCentral Yes this make sense but that's where my concern is with Monolith, what should be the prime consideration to decide which service should be scoped vs transient vs singleton
@@saurabhchauhan232 As long as the object does not maintain any state, meaning it does not have any concern of multi-thread contention issues, it can be a singleton. Or it really needs to be singleton due to business needs, and need to manage state, in which case you need to care for thread contention. In other cases, it can be transient.
@@DotNetCoreCentral Thank you for your reply, Sorry but what I have understood so faf is singleton is for managing state and transient is something that has nothing to do with state
In this video, I have misspoken a couple of times:
At 05:10 I mentioned "three different classes", which should have been "three different objects"
At 10:47 I mentioned "unmanaged method" which should have been "unmanaged objects"
instablaster
@@ibrahimblake1219 thanks for watching!
Your videos are very helpful keep making just like this...The content in it is very good..
@Pritish Ranjan, thanks for watching!
Really well explained. Great video
@
Spencer Mayne, thanks for watching!
Nice video. well done
@X R, thanks for wathcing!
Great video 👍🏻
@shrikant mule, thanks for watching!
Thank you
@Mahendran Chinnaiah, thanks as always for watching!
is there any website or blog of yours on this topic ?
can your share the link
@SIDRA NOOR, thanks for watching! My blog site URL is dotnetcorecentral.com/, though I do not have this captured in my blog yet, I have other topics there if you want to check out.
Thank you !
Question: In .net core DI, we register Transient, Singleton, Scoped. Creating transient and scoped isn't adding additional burden on GC? though singleton is not good option either but this really confuse me, can you please answer if you can?
@Saurabh Chauhan, thanks for watching the video!
Singleton is not necessarily a bad thing if it is done through DI, the reason the singleton design pattern was drawn upon was because of the fact that it was harder to test. But if you use it through DI, that argument is not valid anymore. There are definitely cases for using a singleton, especially if there is no state managed inside the object.
Now in terms of transient and scoped usage, well technically they might cause GC to run more often compared to everything being singleton, but there are cases for using these as well. I will not be too concerned about GC running multiple times, especially in the days of microservices where services are small.
But if you are using a monolithic application, there should be some consideration given for this situation. In which case, you should debate about which all classes make sense making singleton vs not.
Let me know if it makes sense. Thanks
@@DotNetCoreCentral Yes this make sense but that's where my concern is with Monolith, what should be the prime consideration to decide which service should be scoped vs transient vs singleton
@@saurabhchauhan232 As long as the object does not maintain any state, meaning it does not have any concern of multi-thread contention issues, it can be a singleton. Or it really needs to be singleton due to business needs, and need to manage state, in which case you need to care for thread contention.
In other cases, it can be transient.
@@DotNetCoreCentral Thank you for your reply, Sorry but what I have understood so faf is singleton is for managing state and transient is something that has nothing to do with state
@@saurabhchauhan232 I am planning to create a new video on this, hopefully, that should answer your questions.
Time to rename channel xd
@KoScosss, thanks for watching! And yes, I will have to think about the name :)
Types of garbage collection
@naresh talluri, thanks for watching!