ASP.NET Core Web API .NET 6 2022 - 3. One-To-Many Relationships

แชร์
ฝัง
  • เผยแพร่เมื่อ 4 ม.ค. 2022
  • ASP.NET Core Web API .NET 6 2022 - 3. One-To-Many Relationships
    Github Repo For This Project: github.com/teddysmithdev/poke...
    UML Diagram: drive.google.com/file/d/1EbYY...
    Twitter: / teddysmithdev
    Github: github.com/teddysmithdev
    Linkedin: / teddy-smith-015ba61a3
    Website: www.teddysmith.io
  • แนวปฏิบัติและการใช้ชีวิต

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

  • @dq9342
    @dq9342 ปีที่แล้ว +5

    Thanks again! Finished your C# course and progressing in this!

  • @mbulelo-damba
    @mbulelo-damba 2 ปีที่แล้ว +4

    Hi Teddy, thanks for this series of tutorials. I enjoyed and actually learnt a lot regarding your UML Diagram. I'm following this til the end.

  • @user-uc6fs5ke2v
    @user-uc6fs5ke2v ปีที่แล้ว +6

    Truly grateful for the selfless sharing by the author, who is truly a great disseminator of technology. Thank you.

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

      No problem. Thank you for watching!

  • @justadude8716
    @justadude8716 9 หลายเดือนก่อน

    Boosting your videos for the algorithm, great video on relational databases.

  • @leafmagi2796
    @leafmagi2796 2 ปีที่แล้ว +12

    love you Teddy! Last week i simply just searched keyword like java and you bring me to the new world. I have a similar background as you and i get really confused how can i break into the industry. After that i watch every your video, starting to learn C#. This video explaination is amazing because you can visual the complicated relationship and tell in a smooth way. So i cannot just watch the video and go away. You re really crazy man. it seems that you make video every day and burning yourself. Please take a rest man! you work really really hard! and this video is really good, escpecially the parts of key and relationship. i will keep going and follow your track :D i really appreciate you!!!

    • @TeddySmithDev
      @TeddySmithDev  2 ปีที่แล้ว +5

      no joke I read this comment and just said “this guy is right. I ain’t don’t shit today” %100 srs lmao

  • @user-wf8sx3bo8m
    @user-wf8sx3bo8m 10 หลายเดือนก่อน

    Thanks, great video

  • @muttBunch
    @muttBunch 9 หลายเดือนก่อน

    As I'm doing this in my current app, I find myself saying it just like Teddy and moving the mouse, "One...to many...one...to many" lol :D Thanks Teddy.

  • @HussainAl-ahmdi
    @HussainAl-ahmdi 6 หลายเดือนก่อน

    Thanks man I understood how to write code for relationships after 2days from searching .

  • @joaquincataldo8046
    @joaquincataldo8046 9 หลายเดือนก่อน

    Hi Teddy, thank you for all this content. I just got one quick question. According to what I saw in Many To Many rels video, we don't need to specify, for example, the country_id field in Owner's model? Because you are referencing the relationship itself but we are not specifying the country_id field.

  • @dzaninkudus3019
    @dzaninkudus3019 11 หลายเดือนก่อน +5

    Started my journey as a self taught back-end dev recently and i can say the videos up to now are amazing.I am sure to stick around until the end.Mind me asking also if there is a chance that you do a short tutorial about Git

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

      How it's going ?

  • @yankov2206
    @yankov2206 2 หลายเดือนก่อน

    Bro really helpfully videos
    Im trying switch from node js to c#
    Im frontend react dev
    But find job on fullstack. My firrst app on node js was todo. I'm was so impressed such simple app is can't find examples on TH-cam
    Your cours is a masterpiece!
    Thanks for sharing. Its really helpful!
    Best regards!

    • @yankov2206
      @yankov2206 2 หลายเดือนก่อน

      btw, where you deployed this app or your own web site? what platform is (i see its not a git or vercel, heroku?)

  • @SweepAndZone
    @SweepAndZone 5 หลายเดือนก่อน

    You're amazing. Glad I found you

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

    thank you so much sir

  • @user-bq2xe3jp4c
    @user-bq2xe3jp4c 7 หลายเดือนก่อน

    Dude after watching sooo many tutorials from developers from India.... listening yours is sooo much cool lol

  • @sdscode
    @sdscode 9 หลายเดือนก่อน

    Definitively agree on the Django Models comment, kinda interesting sometimes XD

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

    Thanks!

  • @MrLaCritico
    @MrLaCritico 10 หลายเดือนก่อน

    Thank you x3

  • @codysheridan324
    @codysheridan324 ปีที่แล้ว +5

    Hey Teddy great video overall, but I would argue against your comments around 8:40 where you state that an ICollection is not editable. IEnumerable is not editable, but ICollection is derived from IEnumerable and includes additional functionality to add/remove/update elements in the list. Similarly, you state that ICollection will ALWAYS be used in one-to-many relationships for the many.. IEnumerable is also another very popular way to handle one-to-many. Maybe I'm misguiding, so I would love to hear your take on this.

    • @TeddySmithDev
      @TeddySmithDev  ปีที่แล้ว +6

      Thank you for clarifying this. I think I may have been thinking one thing but said another because that makes zero sense. You are indeed correct tho and thank you for commenting!!!!

  • @cathe9370
    @cathe9370 9 หลายเดือนก่อน

    Buen curso!

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

    1:1 basically like having a complex datatype as an entity field.

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

    Bro...I love your tutorials but 10:01 ...not true...I've worked in Flask with SQLAlchemy and the Model definitions are bliss and relationships are easy one-liners. Muuuuuch easier and cleaner in Python...The only reason I'm learning C# now is because my company builds their API's in C# so I need to up my C# game but would be way less code with Python, Flask and SQLAlchemy...can't comment on Django as I've not used it but if it supports SQLAlchemy I assume it would be similar. Here's an example. I have a CoinInfo model in which the symbol_id is a Foreign Key for a table called TickerData. I don't have to have 3 locations to define this connection (like in the many-to-many you need to add some lines in the Primary table, the Ref table and the DataContext class).
    ```python
    class CoinInfo(db.Model):
    id = db.Column(db.Integer, primary_key=True, autoincrement=True)
    symbol_id = db.Column(db.Integer, db.ForeignKey('ticker_data.id'))
    insert_timestamp = db.Column(db.DateTime, default=datetime.utcnow())
    update_timestamp = db.Column(db.DateTime, default=datetime.utcnow(), onupdate=datetime.utcnow())
    ticker_data = db.relationship('TickerData', backref='coin_info', uselist=False)
    ```

  • @Kaivalyamani
    @Kaivalyamani 2 หลายเดือนก่อน

    I guess you are telling it all reverse. For those having confusion in this one-many or many-one relationship, look at some ER daigram examples.
    Pokemon table is the 'one' endpoint and Review table is the 'many' endpoint i.e. one Pokemon can have many review.
    We have ICollection in Pokemon table because One Pokemon can have multiple reviews and thats why we need something to hold list of reviews.
    We have simple Pokemon field in the Review table because one review contains details about a single Pokemon

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

    Cool

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

    Would you add the ? after string for nullable fields?? i.e. public string? Name { get; set; }

  • @random-bd3xg
    @random-bd3xg ปีที่แล้ว

    Hi can you make like a project with dal bal layer with like calling stored procedure also using azure please 😢😢😢😢😢😢

  • @user-gk1lj3me4e
    @user-gk1lj3me4e 2 หลายเดือนก่อน

    Can I use Mysql instead sql server for doin this?

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

    So is this the method for doing specifically Web API models... or is this just one method of doing models for both Web API and MVC... I'm a bit of a "toil on things" person rather than "its good enough to keep building what im doing" ... lol... so I got hung up a little on models... and I've come to find out there are multiple methods, convention based relations and fluent api based relations.
    I like getting my head around everything, and then when I get building again things happen fast

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

      The many to many is what I still get pretzel brained about, as sad as it is to admit lol. I'll blame other life things at the moment though lol.
      One to many is easy, as in one blog entry can have many comments.
      Many to many is where things get stupid lol.
      Like, many to many is easy in the context of say having AppUsers to follow each other....
      AppUser can have many followers, and they can also follow many people.
      The relation is between the AppUser entity and itself, if you will....
      But say, Blogs and AppUsers where AppUser can follow blogs and where a blog can have many followers.... I guess it's the same shit, just a join table entity and the 2 foreign keys, just from two separate classes instead of the same class.
      I need to learn to not make things so fucking complicated lol

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

      @@chadgregory9037 Many-to-many can be extremely difficult to wrap your head around, and there are sadly not very many good tutorials out there about how to efficiently implement a many to many relationship. As you begin to look into many to many relationships you will have to also consider the cascading effects of CRUD operations on your database, as your models now implement primary/foreign key relationships in multiple places.

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

    Hey teddy drop the uml Link

  • @user-wf8sx3bo8m
    @user-wf8sx3bo8m 10 หลายเดือนก่อน +1

    foreign key - relation to other tables

  • @RAMATW2023
    @RAMATW2023 2 หลายเดือนก่อน

    I am confused, Upon setting public Country Country { get; set; } ( @9:14 ) I get Country is a namespace but used like a type.

    • @TeddySmithDev
      @TeddySmithDev  2 หลายเดือนก่อน

      You probably have a misplaced/misspelled keyword in Country

    • @RAMATW2023
      @RAMATW2023 2 หลายเดือนก่อน

      @@TeddySmithDev I didnt, I tried to change it up and missed things up. The namespace ending had the same name "Country" as the class name. Visual studio would only let me select the namespace. I changed the class "Country" to "Country1" to test, I was then able to use the "Country1" class.

    • @meltygear5955
      @meltygear5955 2 หลายเดือนก่อน

      @@RAMATW2023 I'm following the same video and I don't get that problem. Are you sure you have all required files in the Models folder and your namespace at the top of every model file is "namespace PokemonReviewApp.Models"?

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

    Teddy i have a question why is some dev using [forgnkey] and some people dont isnt it better to use that?

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

      Either way is fine. Entity framework has abstracted away the need to have foreign key today, but the way I have is more "explicit". Thanks for commenting!

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

      @@TeddySmithDev thank you for explaining

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

    what to do with enums when making models?

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

      In my MVC course I have an example of enums in models.

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

    South Africa is here

  • @user-pr5qc5jr4k
    @user-pr5qc5jr4k 3 หลายเดือนก่อน

    Teddy can you give all database code , Thanks In Advance

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

      Sry database was deleted way back

    • @user-pr5qc5jr4k
      @user-pr5qc5jr4k 3 หลายเดือนก่อน

      ​@@TeddySmithDev I'm perplexed by the database and struck by the database. Please help me to provide the dbcode.

  • @John_Noble
    @John_Noble 5 หลายเดือนก่อน

    What company do you work for? If it is not a secret

    • @TeddySmithDev
      @TeddySmithDev  5 หลายเดือนก่อน +1

      You can see all past companies I’ve worked for on LinkedIn but I keep current secret because people are crazy.

  • @RamiR2
    @RamiR2 11 หลายเดือนก่อน

    I don't like the fact that you used Pokemon, use a real world example that many people will understand.
    What's a review?

    • @TeddySmithDev
      @TeddySmithDev  11 หลายเดือนก่อน +2

      Replace the words with something that is relevant to your life and learn better 👍

  • @user-mo1sq4mt7l
    @user-mo1sq4mt7l 6 หลายเดือนก่อน

    you need to improve your teaching skills