EF Core Many to Many relationships

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

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

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

    Thank you so much! Well explained even for a Brazilian guy like me, who has English as a secondary language.

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

    One of the best videos explaining this! I’m using it to help build an iOS PassKit web service. The many to many requirement of the Device and Pass seem to map nicely to Author/Book. Thanks!

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

      Glad it helped!

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

      @@Codewrinkles ya I’m pretty much finished with the project now. Thanks again!

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

    Hello Sir, I have followed your tutorial and configured the many to many relationship via the Model Builder. Now I have a problem, how can I perform the CRUD queries in C#?
    I get an error in the intellisense saying that I cannot convert from a class model to a class join model (for example, cannot convert from Movie to MovieWatchList). Do you have tutorials covering this? Please I need help.

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

      have you figured it out?

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

      @@dyaaCoding honestly I can’t remember, it was quite a long time ago

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

    Your music didn’t bother me I found your video very helpful after watching your one to many relationship video. Thank you

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

    Any advice on how you would set this up using DDD?

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

    Am I missing something? Is this how this was done before? Anyhow, nowadays just put ICollection on both classes and entity fc will handle everything else

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

      Yes, things have changed in EF 5 (EF Core 5). To be honest, it's a total mess with different EF versions. For instance on EF for .NET Framework many-to-many relationships are configured by convention (as you said) for quite a few years. However, in EF Core this was never possible and you would need an object for the joining table and configure the relationships manually. In EF Core as part of .NET 5 many-to-many relationships by convention was one of the most expected features. Together with the DbContextFactory useful for Blazor Apps and deskop apps (yes you can create .NET COre WPF apps)/

  • @АйдарИльясов-т3ы
    @АйдарИльясов-т3ы 2 ปีที่แล้ว

    Thanl your for the video. But I still have one question. How to update. Can you explain to me how to with update many-to-many relatinship tables?

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

      Here's a brand new video that might help answer this question: th-cam.com/video/jNW-uCPmIBU/w-d-xo.html

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

    DUDE !!! YOU SAVE MY LIFE!!

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

      Glad to hear that :)

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

      @@Codewrinkles Love you man, keep up the good work.
      I have wasted a lot of time trying to figure this out, thank you so much

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

    how to query the table book and author ?

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

    Thank you so much for the video

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

    Great content, love the passion

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

      Hopefully you watched also the most recent videos. There's even more passion!

  • @AnkitYadav-kz2ei
    @AnkitYadav-kz2ei ปีที่แล้ว

    Hello sir, How will i seed data in These table using EFCore i am facing difficulty in this many to many relationship. kindly suugest .

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

      I think this video might have the answers you are looking for: th-cam.com/video/66UmXtiub90/w-d-xo.html

    • @AnkitYadav-kz2ei
      @AnkitYadav-kz2ei ปีที่แล้ว

      @@Codewrinkles Thank you !!

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

    super clean and time-saving, although I m using java, it makes sense to me

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

      Glad you liked it. The Java and DotNet ecosystem have a lot of things in common.

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

    Great video helped me with school thanks

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

    Can this very same approach be used to define triple many to many to many relationships?

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

      Not sure exactly what you mean, but I guess the answer is yes. An entity can be involved in several many-to-many relationship at the same time.

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

      @@Codewrinkles what I mean is the following, for example, in a shopping app there is an Order entity, which can contain many Products (which consists of 1 product), Bundle (which consists of multiple products, but is coded as a separate entity and an order can contain many bundles in it), and let's say an entity named DiscountCode contains discount codes the user can use to get discount for an order (can use multiple codes per order), making the Order entity result of a many to many to many relationship. What I mean is, can this technique be used to create such entities?
      Sorry if the example mentioned is not the best, I just thought of it on the fly...

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

    Hello Sir, i liked your video, you explained well the content and you took away all my doubts :-)

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

      Glad to hear that. Fortunately, starting EF5 everything is easier as many to many relationships are also created by convention.

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

    Thank you helps alot

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

    plz get rid of background music on your upcoming videos

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

      Is the background music so bothering?

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

      @@Codewrinkles yes! It’s terrible.
      How did you come up with such a dumb idea?

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

      These guys are very alone in their views. Background music 100% is fine and good.

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

      @@chezchezchezchez the music is not the problem, is your pathetic level of attention to the guys explanation, he’s even speaking loudly and everything is clear

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

      He doesn’t have to, as the explanation is clear

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

    Very very good, Thanks a lot

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

    Hello Sir, I have followed your tutorial and configured the many to many relationship via the Model Builder. Now I have a problem, how can I perform the CRUD queries in C#?
    I get an error in the intellisense saying that I cannot convert from a class model to a class join model (for example, cannot convert from Movie to MovieWatchList). Do you have tutorials covering this? Please I need help.

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

      Can you post the code of what you are trying to do?

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

      @@ramimuddin7925 I'm really sorry I missed your question. As it is the same, my previous reply also applies to you. Could you post the code that showcases what you are trying to achieve?

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

      @@Codewrinkles no problem sir. I actually found a way to sort it out. Hopefully, everything is working but is still a bit annoying that there’s no documentation explaining how to handle and query many to many relationships. Maybe that might be a new content to create for your channel 😊

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

      And please ignore my previous reply, it seemed rude, it wasn’t directed to you but to someone who doesn’t even know how to put a proper sentence in plain English. Anyway thanks for your reply and please keep making content. It is really helpful 👍🏽

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

      @@ramimuddin7925 No problem. I'm just trying to help. A video on working with many to many relationships is now on my to do list :). However, I can't estimate a timeline since these weeks I'm fairly busy with work and personal stuff.