Entity Framework Core Tutorial - Everything You Need to Know to Get Started

Sdílet
Vložit
  • čas přidán 20. 12. 2022
  • Hi everyone! This video covers everything you need to know to get up and running with EF Core today!
    We'll talk about the various NuGet packages that we'll add:
    Microsoft.EntityFrameworkCore
    Microsoft.EntityFrameworkCore.Design
    Microsoft.EntityFrameworkCore.Sqlite
    As well as the dotnet-ef command line tool which we'll use to create migrations, the database and more.
    This video doesn't cover complex relational database relationships. I'll cover this in-depth in the upcoming videos in my main series. If you don't want to miss out on it - make sure to smash the subscribe button!
    The GitHub repository we used as the base for the project:
    github.com/amantinband/buber-...
    The full source code of what we wrote today and all the other videos I released in the past is available for my Patrons (It's 5$). If you want it or you wish to support me on my new CZcams endeavor, the link is over here:
    / amantinband
    Connect with me on 'em socials:
    github.com/amantinband
    / amantinband
    / amantinband
    / @amantinband
    #dotnet #efcore #entityframework #amantinband
  • Věda a technologie

Komentáře • 61

  • @amantinband
    @amantinband  Před rokem +22

    Although there are many other great topics (such as relationships) that I didn't cover, I will cover them in-depth with complex examples in the upcoming videos in the number dinners series.
    In any case, I would love to hear what you think and other topics you would have liked to see in this video!

    • @DrHeinzDoofenshmirtz
      @DrHeinzDoofenshmirtz Před rokem +2

      Hi Amichai. Great video and good starter before you go in-depth!
      I would specifically really like you to explain relationships, meaning how do I configure a relationship when I want my class to be as DDD-like as possible.
      And then also how to work with Migrations in a production environment correctly. I understand that you should actually get EF make scripts that are run manuelle or through a pipeline.
      Another topic I would really like to here about is how User should be thought into the domain. I use Auth0 and can't figure out if User is a domain object, or if it is something else. And then I would also like to know how to set identity up correctly. A totally different topic than EF though 😊

    • @kylegivler8372
      @kylegivler8372 Před rokem +1

      Can't wait for the next video in the Buber Dinner Series. Thanks for sharing! I don't know about others, but I would find your videos to be easier to follow if they were just a bit slower paced (for example Tim Corey goes at the perfect pace to code along while watching his videos), and I would prefer longer videos with less co-pilot auto completions and full visibility of all the code typed (boring or not). I know we can't always get what we want, but I did find enough value in your content to become a Patreon :) Anyways thanks again!

    • @xbmcme9768
      @xbmcme9768 Před rokem +2

      I love your videos and have a small request. Can you show a few more lines of code, like 20-25? You are quite the expert and move very fast, I find myself having to stop and forward/rewind videos frequently because the lines of codes you are typing in don't stay on screen long enough. Looking forward to more of your videos!

    • @invictuz4803
      @invictuz4803 Před rokem

      I love your tutorials because you've got real world experience and it shows in the way you introduce your application with some consideration of architecture. There are too many cookie cutter tutorials out there that don't offer nearly as much value as yours. Keep the in-depth videos coming!
      One thing I want to know is how you came up with this app idea of private breakfast events. I've never heard of such a thing lol!

  • @forzafaruandrei
    @forzafaruandrei Před rokem +10

    The moment I see Amichai posted a new video, I know for sure that I'll learn something useful and interesting

  • @manaralkammessy6360
    @manaralkammessy6360 Před rokem +19

    I cant wait for Domain Layer and EF interaction video!!

  • @matthewclements9587
    @matthewclements9587 Před rokem

    Really good video. Using additional diagrams to show how the concepts worked really helped as it gives a different perspective to just seeing the code

  • @Pachwara
    @Pachwara Před rokem +2

    Thank you, Amichai. I can't wait for the video where you link DDD and EF Core together. Keep it up

  • @anamuslimun
    @anamuslimun Před rokem

    Perfect playback speed, you know us man :D Your content is cool! That's the beauty of learning from experienced seniors. I hope you keep posting regularly.

  • @jamesevans6438
    @jamesevans6438 Před rokem +4

    Hey Amichai, absolutely awesome video, thank's so much for the many days it must have taken to put all this together, really liked the flow of design through to implementation, this is better than any dedicated entity framework course I have seen too! - learnt a tun of stuff on this one - I'll be watching this a number of times I think to understand everything. I think this will be really useful to lots of people trying to link DDD to the database via entity framework.

    • @amantinband
      @amantinband  Před rokem

      Thanks, James, really appreciate it 🙏🏼

  • @diegovivanco5378
    @diegovivanco5378 Před rokem

    Thansk Amichai! Good video for beginners in the world efcore

  • @alexalexander3252
    @alexalexander3252 Před rokem

    From this video I learned very important skill- to shift rows up and down with a cursor in fast neurotical way. ;-)

  • @xbmcme9768
    @xbmcme9768 Před rokem

    Great intro to EF!

  • @rdeem1
    @rdeem1 Před rokem

    absolutely love your videos!! I see you have intellisense in the terminal as well, how is this done, on windows?

  • @juliusv2073
    @juliusv2073 Před rokem

    really clean workflow

  • @jdavid82
    @jdavid82 Před rokem +1

    Just have a performance feedback, but first thank you for such an awesome video, I've subscribed. Okay so when you insert lots or rows with Guids defined in C# as Ids, because those values are random, Microsoft Sql Server will have to work hard to place them in the right index location as it inserts each row into the table, if you run a test where you are inserting thousands of rows, you may see a noticeable performance degradation. So I would recommend using int or bigint and let sql server generate the key as autoincrement. If you really want to stick to guids then you can configure them to be autoincrement in sql server and let sql server generate it for you, then you will see that the guids will look very similar one from the next, but that's a configuration on the sql server side, not sure how you would do it on EF, but yeah all good, thank you, awesome video

  • @sauravbhatta5303
    @sauravbhatta5303 Před rokem +3

    I also recommend you to go over in details regarding one to many and many to many relationship in EF core using the diagram.

    • @amantinband
      @amantinband  Před rokem +1

      Do you mean presenting the relationships via a model diagram in Visual Studio?

    • @sauravbhatta5303
      @sauravbhatta5303 Před rokem

      @@amantinband absolutely

  • @avecesar
    @avecesar Před rokem +1

    Thank you!

  • @csarts990
    @csarts990 Před rokem

    Can you please tell me what extension do you use to suggest the code pieces ? thx a lot

  • @felixnotthecat4249
    @felixnotthecat4249 Před rokem

    What software did you use to draw the diagrams?

  • @caiolopes8693
    @caiolopes8693 Před rokem +2

    Great Video Amichai! Can you do a video explaining how to use EF Core for an existing Data Base? I mean, using EF Core with a DB first approach. Thank you!

  • @matejl92
    @matejl92 Před rokem +1

    Is there any particular reason you prefer doing the configuration of entities in a fluent way instead of using data attributes?

  • @skrp3596
    @skrp3596 Před rokem

    Hey Amichai,
    I've been following your previous video about implementing the different aggregates in ddd. How would I approach the saving and loading of the different id types through ef core?

    • @amantinband
      @amantinband  Před rokem

      Let me know of you still need help with this after today’s video 🙂

  • @ahmeddabas
    @ahmeddabas Před 8 měsíci

    thanx bro , can u make a video to explain Backing Fields in EF Core

  • @waliqadri
    @waliqadri Před rokem

    Where does this course start from? what is bubber breakfast app?

  • @DENDYTWOO
    @DENDYTWOO Před rokem

    Thank you for your video, Amichai! Can you tell me what a program that let you do arrows and rectangles on your screen?

    • @DENDYTWOO
      @DENDYTWOO Před rokem

      And one more question is why are you using .Find() not FirstOrDefault() or SingleOrDefault()?

    • @amantinband
      @amantinband  Před rokem +2

      @@DENDYTWOO Thanks! I use Presentify on MacOS, and ZoomIt on Windows

    • @amantinband
      @amantinband  Před rokem +1

      Regarding Find vs FirstOrDefault, Find will avoid calling the DB if it can. Here are some more details: stackoverflow.com/a/58779047/10091553

  • @the-nasim
    @the-nasim Před rokem

    Great video. I have a question is it a bad idea for having multiple DbContext for a single database. One for ReadOnly, one for WriteOnly.

    • @andreistelian9058
      @andreistelian9058 Před rokem

      If you use it only like that, I don't find a problem with that. But I think it's an overkill if you don't have a very big enterprise application. If you do have that kind of app, maybe it would be better to use replica counts.
      Replica counts are a way to have multiple databases of the same data. This saves you a lot of time, if you have let's say a lot of writes, since the DBs put a lock both on read and on write when a write is made to the Database.
      So, by using replica count, you can have only one database to only make writes, and another 2 or 3 replicas of the first db that are used only to make reads.
      Hope I've made myself understood

    • @the-nasim
      @the-nasim Před rokem

      @@andreistelian9058 Thanks for your very helpful answer. I didn't know about replica count. I find this very interesting. I will take a look. Again many thanks.

  • @borisgomiunik7960
    @borisgomiunik7960 Před rokem

    Thank you for many explanations, Amichai, many concepts are clear now. What I do still find confusing is why ChangeTracker marks entity as unmodified if its collectoin changes (navigation property). Is this intentional?

    • @amantinband
      @amantinband  Před rokem +1

      Thanks, Boris. The change tracker is for EF Core to know what tables to update. It helps to think of the underlying tables and what data needs to be deleted/modified/added

    • @borisgomiunik7960
      @borisgomiunik7960 Před rokem

      @@amantinband It actually makes sense, thank you for your reply. Any tips on where to look for the original values for collections (kind of like in properties in change tracker)?

  • @tibba69
    @tibba69 Před 9 měsíci

    I really wish we could use EF Core but as far as I know, it does not support the database my company is stuck using - IBM for i or DB2 iSeries (or whatever it’s called these days).
    To make it worse we are stuck on version v5r4! 😢
    Does anybody know if EF Core can be used for this as I haven’t been able to find anything for years.

  • @juke-duke
    @juke-duke Před rokem +2

    How do you have the option to sync namespace with the folder you are in when moving it around?

    • @amantinband
      @amantinband  Před rokem

      I have a vscode extension called "C# Namespace Autocompletion" that I use for defining namespaces (I usually use the namespace-fill option)

    • @juke-duke
      @juke-duke Před rokem

      @@amantinband I use the extension aswell, but Im talkong about you had this option say like to sync the namespace with the folder structure. You moved a file to another folder and were able to match the namespace and change it everywhere, I have to manually go and change all my namespace references when I move the file around. How did you do this, and thank you.

    • @juke-duke
      @juke-duke Před rokem

      @@amantinband Any information on this would be greatly appreciated, it definitely helps refactoring on vscode so much

  • @brunoweb4
    @brunoweb4 Před rokem

    Can you give us a little spoiler about using EF on the DDD Project?
    (I am guessing that you are gointg to create some kind of model classes to satisfy EF on the infra layer + using mapster to map them to domain classes)

    • @amantinband
      @amantinband  Před rokem +2

      Sure 😁 The configuration files are the mapping between the domain models and the actual database. I don't think another anti-corruption-style set of models is needed.

  • @shuvbhowmickbestin
    @shuvbhowmickbestin Před 3 měsíci

    Don't get why the properties must be made private regardless of the fact that EFCore iterates over the properties and adds them to the migration definition. I mean why must they be private? And why must we have an empty constructor for Breakfast for EfCore to work? Timestamp: 17:56

  • @narekhovhannisyan6362

    Amichai are you Armenian? 😊

  • @mauriziostrazzullo1419
    @mauriziostrazzullo1419 Před 7 měsíci

    What is the point of studying if you are going to replace us all?

  • @rabenstein9234
    @rabenstein9234 Před 2 měsíci

    What happened to your voice?

  • @xxapoloxx
    @xxapoloxx Před rokem +1

    This is borderline unintelligible