Dependency Injection in Desktop Apps

แชร์
ฝัง
  • เผยแพร่เมื่อ 19 ธ.ค. 2024

ความคิดเห็น • 18

  • @CodingTutorialsAreGo
    @CodingTutorialsAreGo  3 ปีที่แล้ว

    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 👍.

    • @NillKitty
      @NillKitty 3 ปีที่แล้ว

      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?

  • @peternguyen9382
    @peternguyen9382 ปีที่แล้ว +1

    thanks so much! you are awesome! you help me with DI. I dont have a clear picture until i see your videos!

  • @SharafMansour
    @SharafMansour 3 ปีที่แล้ว +3

    I am fascinated by the true beauty of dotNet and C# language design.
    It always has more to offer.
    Love your videos!

  • @prenotrigger
    @prenotrigger 2 ปีที่แล้ว +1

    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!

  • @soixantelly
    @soixantelly 2 ปีที่แล้ว +1

    DI in .NET is the best designed and well throughout DI i've ever used

  • @piotrjan2927
    @piotrjan2927 2 ปีที่แล้ว +1

    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.

  • @hozmannew896
    @hozmannew896 2 ปีที่แล้ว +1

    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

  • @thesituation5315
    @thesituation5315 2 ปีที่แล้ว

    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?

  • @ivanreii
    @ivanreii 3 ปีที่แล้ว

    I love your video thumbnails 😂

  • @Praveen.Kumar.
    @Praveen.Kumar. 3 ปีที่แล้ว +1

    Definitely liked! Thank you sir!

  • @mrt7948
    @mrt7948 2 ปีที่แล้ว

    sir, how do i use the serviceprovider from Forms?

    • @CodingTutorialsAreGo
      @CodingTutorialsAreGo  2 ปีที่แล้ว

      I'm not sure what you mean - can you give a bit more detail?

    • @mrt7948
      @mrt7948 2 ปีที่แล้ว

      sir, when ever i need to use the service from any forms do i call like this? var repo = Program.ServiceProvider.GetRequiredService();

    • @CodingTutorialsAreGo
      @CodingTutorialsAreGo  2 ปีที่แล้ว

      @@mrt7948 When you say 'Forms', do you mean a WinForms application?

    • @mrt7948
      @mrt7948 2 ปีที่แล้ว

      @@CodingTutorialsAreGo yes sir

    • @CodingTutorialsAreGo
      @CodingTutorialsAreGo  2 ปีที่แล้ว

      @@mrt7948 Yes, that should work fine.

  • @mariotoshev4581
    @mariotoshev4581 2 ปีที่แล้ว +1

    THANK YOU!