Any other feature that you want to use outside of ASP.NET? Let me know. Source code at: github.com/JasperKent/Console-Dependency-Injection Remember to subscribe at th-cam.com/channels/qWQzlUDdllnLmtgfSgYTCA.html And if you liked the video, click the 👍.
OK but one last thing; how do you invoke a method call (besides a constructor) and do DI on the parameters, such as ASP's Configure() or a Controller's action method or a Razor Page's OnGet handler?
Man! Have been looking for a DI solution for desktop applications. Most tutorials point to third party packages. I was specifically looking for this. Plus a clear explanation on the service scopes. Love your videos! Keep it up! Thanks!
Great explanation of the scope object! I have seen a few examples of web API applications (.Net5 Core), where access to the DI services was acquired in a similar fashion inside Main method (to perform seeding and run migrations automatically): public static async Task Main(string[] args) { var host = CreateHostBuilder(args).Build(); using(var scope = host.Services.CreateScope()) { var services = scope.ServiceProvider; var context = services.GetRequiredService(); await context.Database.MigrateAsync(); ... } host.Run(); } But I couldn't quite get this whole business of obtaining the scope and then using it to get access to the services. I did not understand why all these steps were needed and what they were actually doing. Now I can see the intention was to create a scope, use some (scoped) services within this scope. And then to clear everything from the DI before starting the web server.
Great explanation, you cleared everything. Thank you so much, please if you have time i want to explain the ways of Saving and Retrieving Data in Database in Multilanguage Support, and what is the best approach
This video was pretty helpful. I'm not sure if you're still active on TH-cam, but I had a question. If I'm making a Windows Forms GUI Desktop Application, should I declare the new constructor (for my main form and it's settings form) in Program.cs? And if I need to access the main form from two different classes, what would be the best way of doing that?
Any other feature that you want to use outside of ASP.NET? Let me know.
Source code at: github.com/JasperKent/Console-Dependency-Injection
Remember to subscribe at th-cam.com/channels/qWQzlUDdllnLmtgfSgYTCA.html
And if you liked the video, click the 👍.
OK but one last thing; how do you invoke a method call (besides a constructor) and do DI on the parameters, such as ASP's Configure() or a Controller's action method or a Razor Page's OnGet handler?
thanks so much! you are awesome! you help me with DI. I dont have a clear picture until i see your videos!
I am fascinated by the true beauty of dotNet and C# language design.
It always has more to offer.
Love your videos!
Man! Have been looking for a DI solution for desktop applications. Most tutorials point to third party packages. I was specifically looking for this. Plus a clear explanation on the service scopes. Love your videos! Keep it up! Thanks!
DI in .NET is the best designed and well throughout DI i've ever used
Great explanation of the scope object! I have seen a few examples of web API applications (.Net5 Core), where access to the DI services was acquired in a similar fashion inside Main method (to perform seeding and run migrations automatically):
public static async Task Main(string[] args)
{
var host = CreateHostBuilder(args).Build();
using(var scope = host.Services.CreateScope())
{
var services = scope.ServiceProvider;
var context = services.GetRequiredService();
await context.Database.MigrateAsync();
...
}
host.Run();
}
But I couldn't quite get this whole business of obtaining the scope and then using it to get access to the services. I did not understand why all these steps were needed and what they were actually doing.
Now I can see the intention was to create a scope, use some (scoped) services within this scope. And then to clear everything from the DI before starting the web server.
Great explanation, you cleared everything. Thank you so much,
please if you have time i want to explain the ways of Saving and Retrieving Data in Database in Multilanguage Support, and what is the best approach
This video was pretty helpful. I'm not sure if you're still active on TH-cam, but I had a question. If I'm making a Windows Forms GUI Desktop Application, should I declare the new constructor (for my main form and it's settings form) in Program.cs? And if I need to access the main form from two different classes, what would be the best way of doing that?
I love your video thumbnails 😂
Definitely liked! Thank you sir!
sir, how do i use the serviceprovider from Forms?
I'm not sure what you mean - can you give a bit more detail?
sir, when ever i need to use the service from any forms do i call like this? var repo = Program.ServiceProvider.GetRequiredService();
@@mrt7948 When you say 'Forms', do you mean a WinForms application?
@@CodingTutorialsAreGo yes sir
@@mrt7948 Yes, that should work fine.
THANK YOU!