Entity Framework Core Part 1 - Code First Generation

Поділитися
Вставка
  • Опубліковано 19 вер 2024

КОМЕНТАРІ • 34

  • @CodingTutorialsAreGo
    @CodingTutorialsAreGo  4 роки тому +2

    Anything specific you'd like to know about Entity Framework? Just ask.
    Dowload the source code from github.com/JasperKent/Entity-Framework-Code-First
    This is just the first in a series, so do subscribe at: ua-cam.com/channels/qWQzlUDdllnLmtgfSgYTCA.html

  • @sagivalia5041
    @sagivalia5041 Рік тому +1

    I had so much freaking troubles when I tried to access the foreign object in my models, because EF maps an object to the table, I assumed it would do so but since it didnt I thought the way I described the relations was wrong because I designed the SQL relations like you would in SQL, for 2 days the foreign object was null, solved the problem with your eager/lazy loading explanation.
    Thank you so much.

  • @thuyuyenlovely8053
    @thuyuyenlovely8053 3 роки тому +3

    Amazing !
    The instructor is very knowledgeable .

  • @Chapali9a
    @Chapali9a 3 роки тому +6

    You, sir, are amazing. Thank you very much indeed for this fantastic video and hopefully series. I will now have to go through all your videos 😁.
    Cheers

  • @ghostslinger3148
    @ghostslinger3148 2 роки тому +3

    Very easy to follow as a begineer!
    Awesome tutorial, look forward to your series!

  • @adambelos6129
    @adambelos6129 3 роки тому +2

    that is all i needed :D for more then a 2 months thanks sir perfect video keep it up please

  • @AlbrechtJ
    @AlbrechtJ 2 роки тому +2

    Thanks for the excellent video. Clear explanation.

  • @_lamakumba8059
    @_lamakumba8059 Рік тому +1

    Just brilliant the way you explain it! Thank you

  • @rdcarbonk1885
    @rdcarbonk1885 Рік тому +1

    In following the common idea of practice makes perfect i also decided to make a simple book library using EF6.

  • @isho7777
    @isho7777 Рік тому +3

    Was trying to follow but it start with a ready made project. Maybe you could show how it was set up a little bit

  • @seraj8020
    @seraj8020 2 роки тому +2

    Very good explanation😀

  • @hanh.trinh.yeu.thuong
    @hanh.trinh.yeu.thuong 2 роки тому +2

    thank you very much!

  • @rezakhakpour7549
    @rezakhakpour7549 3 роки тому +2

    very useful video for my job. so when i use Include(), im using eager-loading approach.

  • @mudrecsalimkhanov329
    @mudrecsalimkhanov329 Рік тому +1

    Thank you !!!

  • @rOxhhh
    @rOxhhh 2 роки тому +2

    Gracias por los substitulos

  • @nick11927
    @nick11927 3 роки тому +2

    Should we only have 1 DbContext class per application? In this example its trivial but I have some confusion there

    • @CodingTutorialsAreGo
      @CodingTutorialsAreGo  3 роки тому +1

      Good question.
      If we're talking about the derived DbContext class, then I'd say one class per database. If you application connects to two separate databases, then you need two DbContext classes. I've seen two different DbContext classes connecting to different subsets of tables in a single database, but it causes confusion, and is inefficient if you then decided you need to join between tables in the different subsets.
      When it comes to objects of the DbConext, then their should be lots of them and very short lived. Roughly their lifetime should correspond to a single transaction. If you put them in a using block, that will give them a short lifetime.
      Should be said, my views on this come from use mostly in web-based applications. You might tend to longer lifetimes for a desktop application, but not too much longer.

    • @nick11927
      @nick11927 3 роки тому

      ​@@CodingTutorialsAreGo I suppose my point would be the different subsets of tables in a single database like you mentioned. My understanding (I'm new at EF!) is we need a DbSet per table in the database so it can be created and migrated, but would we add here also any Entities? Perhaps I have not made it far enough in my learning to have this answered for me yet.
      For example, and please forgive my terminology, we have a Person table, which has a reference to an Address table, and Person also has reference to an Email table. So we create 3 DbSets for each to represent the tables created in the database, and define the relations of these tables in their model.cs files.
      Now say I want to have the concept of a FullPersonDetail entity (or something) which is is represented internally by the 3 tables/models above that returns all the details of a person + their address and email.
      Would I create this "Entity" in the DbContext or simply when requesting this information I write a query (linq say) that simply does the joins and returns this data.
      I hope I'm not confusing when I say entity, I am understanding this as a unit of information and not based on what we called the individual models used by EF to create tables, so my FullPersonDetail entity is a combination of 3 models in this example. I hope this makes sense and thank you again!

    • @CodingTutorialsAreGo
      @CodingTutorialsAreGo  3 роки тому

      I'm not sure I understand what FullPersonDetail is here. If Person already associates a Person, and Email and an Address, then what does FullPersonDetail bring to the party?

    • @nick11927
      @nick11927 3 роки тому +1

      @@CodingTutorialsAreGo I think it's just late here and I've been overthinking some basic concepts. I appreciate the help!

  • @gaurud
    @gaurud 2 роки тому +1

    Hi, how were you able to type override and then given options to override. Does not seem to work in my visual studio community 2022

    • @CodingTutorialsAreGo
      @CodingTutorialsAreGo  2 роки тому

      Hmmm. It should work, even in Community. You have to type a space after override - is that it?

  • @lesterllorca4837
    @lesterllorca4837 3 роки тому +1

    Hi there, I am using VS Code in Ubuntu and wondering what kind of template command should i use to create this project? Thanks

    • @CodingTutorialsAreGo
      @CodingTutorialsAreGo  3 роки тому +1

      BookLibrary is just a library, so dotnet new classlib -o "BookLIbrary.
      EntityFramwork is a console app, so dotnet new console -o "EntityFramework"

    • @lesterllorca4837
      @lesterllorca4837 3 роки тому +1

      @@CodingTutorialsAreGo so they are two separate projects that works together. Just wondering what is the purpose of the .sln especially when using other OS. I am using Ubuntu and VSCODE

    • @CodingTutorialsAreGo
      @CodingTutorialsAreGo  3 роки тому +1

      @@lesterllorca4837 For .NET projects I pretty much exclusively use full blown Visual Studio. As I understand it, .sln files are a purely a Visual Studio concept. In VS Code (or other editors) you work on a folder basis, so you'd need to have an overarching folder above the two sub-projects. I think it's probably worth me putting together a video on this, but it'll be a few weeks.

    • @lesterllorca4837
      @lesterllorca4837 3 роки тому +1

      @@CodingTutorialsAreGo I appreciate all the uploads and comments. Going to binge watch all your playlist starting on this one. Thanks :)

  • @UnknownMoses
    @UnknownMoses 2 роки тому +1

    Plural table names drive me crazy do not like them.

    • @CodingTutorialsAreGo
      @CodingTutorialsAreGo  2 роки тому

      I sympathize, but I've always presumed that's because I come from and OO background rather than a DBA. Are you the same?

    • @UnknownMoses
      @UnknownMoses 2 роки тому +1

      @@CodingTutorialsAreGo I've been programming since before OO. For me in visual basic 95 OO really started for me in the mid 90's I have focused on that. C# came along with full OO.
      My issue with pluralization on table names is consistency. For example if you have singular vs plural. Category or Categories, Box or Boxes, Person or People, Item or Items and then readability such as Upc or Upcs. For me over 30 years. I've found table names for singular are easier to remember. With the added caveat less typing.

    • @UnknownMoses
      @UnknownMoses 2 роки тому +1

      @@CodingTutorialsAreGo I am writing my first entity framework app at work. I had written one a few years ago for home to track personal data in entity framework 6. I prefer database first because data loss makes me nervous on changes to production system when adding features. I work for a small company so I do full stack development where I am also a database admin.

  • @jambaceesay8183
    @jambaceesay8183 3 роки тому +1

    Thank you so much.