Master the Options Pattern in .NET 9 with Dependency Injection | ASP.NET Core Tutorial

แชร์
ฝัง
  • เผยแพร่เมื่อ 27 ม.ค. 2025

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

  • @UmutDereWork
    @UmutDereWork 14 วันที่ผ่านมา +1

    Great demonstration, thanks for effort.
    What would be a good use case scenario for the IOptionsSnapshot and IOptionsMonitor interfaces?

    • @PoornaSoysaTech
      @PoornaSoysaTech  13 วันที่ผ่านมา +2

      Thank you for your feedback! I'm glad you enjoyed the video.
      IOptionsSnapshot is a scoped services and this is best used in scenarios where you have a scoped service or a short-lived object and need the freshest configuration for every request. It’s perfect for a web application where settings can change per request.
      IOptionsMonitor is a Singleton service that retrieves current option values anytime, ideal for reacting to runtime configuration changes like switching database connections.

  • @buck1998
    @buck1998 17 วันที่ผ่านมา +1

    Hey Pooran,
    i recently encountered a problem in .net core where i need to perform a put operation on a main model and CRUD on its sub model,
    I was not able to achieve this at a same time as this was making a conflict between the entity tracking system,
    finally i added the ignore in the mapping, Do have more accurate way to achieve that thing?
    I will really appreciate your effort 😊😊

    • @PoornaSoysaTech
      @PoornaSoysaTech  16 วันที่ผ่านมา

      Hi, Can you explain more with sample code?

    • @buck1998
      @buck1998 9 วันที่ผ่านมา

      @@PoornaSoysaTech hey sorry for the late reply
      Suppose I have A model
      public class Generation{
      //some initial props
      public Icollection subgens {get;set;}
      }
      now what i want is that
      in repository i will do like
      """"
      return _context.generations.include(s => s.subgens)
      """"
      now in controller i want to
      perform CRUD on subgen as well as the generation itself
      did you got my point

    • @MUZAKIGAMER
      @MUZAKIGAMER 2 วันที่ผ่านมา

      ​@@buck1998read about query filters they will help u i hop