Factory Method Design Pattern [An Introduction for .NET Developers (using C#)]

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

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

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

    Awesome! thanks for this video, if you try to register like scoped or Transient there are this error: "Cannot implicitly convert type string to system.IServiceProvider"

  • @zeusmortegh7538
    @zeusmortegh7538 7 หลายเดือนก่อน

    The way you implemented is very similar to strategy pattern, practically is the same. Can you please clarify me the difference? because here you selected a particular behavior on runtime based on the type, that's the definition for strategy pattern instead of factory pattern.
    Thanks in advance

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

    Awesome! it just answered the question in my brain!

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

    Please make a video on Abstract factory design pattern

  • @nicklaspillay7923
    @nicklaspillay7923 3 หลายเดือนก่อน

    Nice video, in my opinion lambda looks disgusting in line rather in a it's on class hahah, I know it was just a demo! :P

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

    Is this is factory design pattern? The name in the heading is factory method design pattern. Can you say difference between factory and factory method design pattern or can you please make video of factory method in .net core

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

      @Noufal P, I have covered both in my channel, if you watch both of them it should be clear the difference. After watching both if you still have confusion, please let me know, I will be more than happy to explain.

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

      Thanks for the reply. I didn't found factory design pattern in .net core in your channel. Can you give link of factory design pattern in .net core in your channel.

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

      @@noufalp3464 This is the url for the Abstract factory design pattern: th-cam.com/video/NZLk__ZR5ww/w-d-xo.html

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

      @DotNet Core Central, thank you

  • @anurag3487
    @anurag3487 ปีที่แล้ว

    Appreciate your efforts but this is not Factory method design pattern, rather this implementation is of a Simple Factory Design pattern.
    Factory method design pattern states that "It provides an interface for creating objects in a superclass, but allows subclasses to alter the type of objects that will be created."
    In the video, we are just returning instances of the subclasses based upon the type - this is simple factory design pattern implementation.

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

    It's amazing 😍😍😍

  • @vivek.tiwary
    @vivek.tiwary 3 ปีที่แล้ว +1

    Why have you registered as singleton?

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

      @Vivek Tiwary, since there is no state maintained, singleton just fits the bill. I will not use singleton if I have a complex state inside the object.

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

      question is not allowed. comments are welcome

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

    Muy bueno

  • @2005bgva
    @2005bgva 2 ปีที่แล้ว

    Maybe for some one this can be useful: In first aproach minute 2.50, into Startup.ConfigureServices sadd: services.AddSingleton(); services.AddSingleton(); services.AddSingleton(); . And inside LawnMowerCatalogController create a constructor with this sign: IEnumerable lawnmowerCatalog then you can test this aproach.