Это видео недоступно.
Сожалеем об этом.

EF Core 6 🚀 Database First / DB First (Entity Framework Core 6 / .NET 6)

Поделиться
HTML-код
  • Опубликовано: 13 авг 2024
  • 🚀 Join the .NET Web Academy with a 30% discount - closing soon!
    👉 www.dotnetweba...
    🔥 Blazor E-Commerce Course: www.udemy.com/...
    📧 Newsletter: newsletter.pat...
    ❤️ Ko-fi: ko-fi.com/patr...
    ☕ Coffee: www.buymeacoff...
    🐦 Twitter: / _patrickgod
    📓 Articles: / patrickgod
    🔥 Blazor Bootcamp: www.udemy.com/...
    🚀 .NET Jumpstart Course: www.udemy.com/...
    Table of Contents:
    00:00 EF Core 6 🚀 Database First
    01:55 SQL Server Database Overview (SQL Server Management Studio)
    04:05 Create an ASP.NET Core Web API Project
    04:50 Install NuGet Packages
    06:04 Scaffold the DbContext
    08:44 Check the created Models
    10:37 Register the DbContext in the Program.cs
    11:16 Create an empty API Controller
    13:42 First Test of the Controller
    15:18 Include Related Entities
    17:00 Scaffold after making changes to the Database
    19:01 DB First Alternative?
    21:09 Use the dotnet CLI
    23:21 Closing Words
    🙏MANY THANKS TO THESE LOVELY PEOPLE:
    James Goforth
    @williamdevine
    Doug Nelson
    Arif Hasanov
    @kohji1712
    @dlb78dlb
    Thomas Korsgaard
    FastTrak
    Jeff Sager
    Dan Moyer
    AlgoMarket
    Mennskr
    Mehmet Ali Ege
    Simon
    Hermann Rösch
    Jim McNeal
    Kieron
    @mgrainger231
    Gerrit Esmeijer
    Axel
    Kareem Skinner
    Joaquim
    Alain Legrand
    Per Rieland
    @prodrigu75
    Greg
    Brendan Maunder
    Stageoner
    Andrew Campbell
    pascalditzfeld
    PovilasSimanskas
    Ameet Jayawant
    jenö
    Marco Otilli
    Mark
    l33ter
    alibux
    g.dassel
    Luke Vincent
    mrcl
    Alain Legrand
    Thomas Werner
    István Csibor
    Grant Burdon
    @gianluigiconti
    Gerrit Esmeijer
    Illia
    Németh-Pók István
    Michael Mel
    Marko Zdilar
    GerryB
    @DADA_universe
    Domen Hren
    @heroesch
    Carey
    Peter De Tender
    Baris Keskin
    @Big_Bear_27390
    Mathias
    walter e watkins
    Günther Dassel
    Axel
    Josh
    Daniel Huber
    Fredric Adell
    Juan Carlos
    Manolis
    Pajani
    P.
    Jonas Granlund
    Bobby
    Kristina
    @xamarin007
    #DotNet #EfCore #PatrickGod

Комментарии • 85

  • @PatrickGod
    @PatrickGod  11 месяцев назад

    🚀 Join the .NET Web Academy with a 30% discount - closing soon!
    👉 www.dotnetwebacademy.com/courses/academy?coupon=dnwas23yt

    • @hyd119
      @hyd119 9 дней назад

      If you are interested in getting paid something and helping me get used to some legacy dotnet core things let me know :)

  • @user-gg4bg2vi3t
    @user-gg4bg2vi3t Месяц назад

    Your videos are incredibly practical and easy to understand. Thank you so much for sharing such valuable content!

  • @CiaranCorrigan86
    @CiaranCorrigan86 2 года назад +2

    Great coincidence; this is exactly what I am looking for right now after watching an older video of yours last night, about WebAPI & EFCore.

    • @PatrickGod
      @PatrickGod  2 года назад

      Perfect! Glad I could help! 😄

  • @OmPrakash-rs4jm
    @OmPrakash-rs4jm 2 года назад +3

    I was eagerly waiting for db first approach. thanks alot Patrick.

  • @sidakgujral2768
    @sidakgujral2768 10 месяцев назад

    Thanks patrick God a lot of love from INDIA I have leant so many things in dotnet core 6 for my work i love your tutorials easy and fast keep it up

  • @johngumboc684
    @johngumboc684 Год назад +2

    Love your videos. Sometimes your only choice is DB First when your dealing with an existing database. I have had success using partial classes in a separate metadata and partial class cs files with the annotations in a Metadata.cs, that way your data annotations don't get wiped out when you run another scaffold-dbcontext command.

  • @ersangokalp200
    @ersangokalp200 2 года назад +2

    Dapper would be great to learn 🙏

  • @daviddonadze221
    @daviddonadze221 Год назад +1

    Thank you so much for a nice video. I needed to remind myself DB-first approach. U the best

  • @eugenekim1861
    @eugenekim1861 Год назад +7

    Can you make a video with a practical/real-world example of EF such as using views, and complex relationships with multiple tables, rather than using simple DB schema? That would be much helpful.

    • @shivakumarnarayanan1165
      @shivakumarnarayanan1165 Год назад

      Have u found a tutorial that covers more real world examples?

    • @eugenekim1861
      @eugenekim1861 Год назад

      @@shivakumarnarayanan1165 Unfortunately no. Most YT tutorials are not covering real-world examples but just simple/basic ones. If I have one, I WILL subscribe to their channels and give them thumb-ups FOR SURE. Anyway, I wish to find one on GitHub or somewhere.

  • @marna_li
    @marna_li 2 года назад +1

    I used to work for a guy who insisted we would design the database-first. In that way he, the owner/business analyst/database administrator, could modify the structure as he imported customer data - and that is is more efficient. Essentially, he wanted control. So I scaffolded it initially. We were developing in the production database.

  • @nelsonrivers8546
    @nelsonrivers8546 2 года назад +1

    Was waiting for this. Thank you.

  • @pw.70
    @pw.70 8 месяцев назад

    Just as a note, the classes used for the automated build of these classes are all defined as public partial. That means that any extended properties and functionality can be attached to the model classes. I tend to do this in a folder called 'Extenders'.

  • @horaciodelgadillo
    @horaciodelgadillo 4 месяца назад

    Wow.. este fue un excelente video, gracias!

  • @jeremaine
    @jeremaine 2 года назад +2

    woooo finally!! :)

  • @thotchs4116
    @thotchs4116 2 года назад +1

    i wating for this conten for a long long time. finally ;)

  • @Tamer_Ali
    @Tamer_Ali 10 месяцев назад

    Thanks Patrick for this awesome video.
    I hope you create a video about using EF Core Power Tool

  • @troymitchel4790
    @troymitchel4790 Год назад +2

    Thanks for creating this Patrick. Really helpful. Don't most high revenue companies already have existing databases? Wouldn't DB first approach be the most common way anyways? Code first is usually for teaching or for creating brand new databases. I seriously doubt that most companies are allowing people to create a new database every time they need software written.

  • @The_Ethical_Slacker
    @The_Ethical_Slacker 8 месяцев назад

    Nicely informative, thank you.
    I think the big thing I take from this... you touch on this a little throughout but especially at the end... is the fragility of the link between code and database. For me, this makes me ask... do I *want* the code to know about the database? Because someone's going to change the database without telling anyone, and it's going to break the application.
    Okay, there needs to be *some* knowledge between the two, just for the solution to work, but we should probably aim for that knowledge to be minimal.

  • @elliottwavechina721
    @elliottwavechina721 Год назад

    more topics about code first, but less for database first which is more commonly used , your video is very helpful

  • @STUPIDYOUTUBE_HIDINGMSGS
    @STUPIDYOUTUBE_HIDINGMSGS 2 года назад +2

    Another good learning material from you! Thank you for sharing your knowledge!

    • @PatrickGod
      @PatrickGod  2 года назад

      Glad I could help! Thanks for your feedback, Jack! 😊

    • @muhammadumar-lw9fg
      @muhammadumar-lw9fg 7 месяцев назад

      @@PatrickGod please can you provide SQL for creating database with values ?

  • @aussieraver7182
    @aussieraver7182 11 месяцев назад +1

    Legend!

  • @user-ou2nk8ff1n
    @user-ou2nk8ff1n Год назад +1

    It's just awesome

  • @mandarkarnik
    @mandarkarnik 2 года назад +1

    What about Editor like earlier .net framework 4.7.2 EF 6. editor? How to use store procedure based approach with .net COre EF? If my table consists for billions of records, I do not want to use table based approach? Any simple editor available?

  • @nittinaggarwal1068
    @nittinaggarwal1068 2 года назад +1

    Very nice video. I just want to know how we can call the stored procedure as well using the same code above.

  • @dianatorrontegui7505
    @dianatorrontegui7505 Год назад +1

    Great content, thanks!!

    • @PatrickGod
      @PatrickGod  Год назад

      Glad you liked it! Thanks for your feedback! 😊

  • @angelachoi3695
    @angelachoi3695 Год назад +1

    Thank you!!

  • @bobchu5314
    @bobchu5314 6 дней назад

    Please make a tutorial do EF6 Database First with DB is SQLite

  • @sarwalgaurav
    @sarwalgaurav 2 года назад +1

    Thanks for this video, its simple and well explained, can you please share how can we take this scaffold database context and migrate to code first for any further changes to database, like adding new tables or changes to existing tables etc.

  • @MehmetAliEGE
    @MehmetAliEGE 2 года назад +1

    Thanks God. In both senses. :)

    • @PatrickGod
      @PatrickGod  2 года назад

      You're very welcome! 😄

  • @rogeriolima8152
    @rogeriolima8152 14 дней назад

    In real world, inside companies, I will almost NEVER be allowed to run a program that make
    changes in DB structure (this is unthinkable), as code first does. But database first... well ok maybe we can use.

  • @nelsonrivers8546
    @nelsonrivers8546 2 года назад

    With Dapper, one issue is that is does not provide "concurrency checking". Can you address how to handle "concurrency issues" that could arise when using Dapper to do UPDATE, INSERT, DELETE operations ?

  • @MitroiBogdan-ef3ei
    @MitroiBogdan-ef3ei 3 месяца назад

    10:30 Why is class User defined as virtual : public virtual User User {get; set;} ???

  • @inanogluahmet
    @inanogluahmet Год назад +1

    What to do if table columns in database are changed later?

  • @christoffermartell193
    @christoffermartell193 2 года назад

    Great video.

  • @khubaibquadri7977
    @khubaibquadri7977 10 месяцев назад

    What does virtual keyword does with the attributes?

  • @RunningDigger
    @RunningDigger Год назад

    thank you very much!

  • @RockoShaw
    @RockoShaw 6 месяцев назад

    what about the username and password>? how does that is input into the PM console to be able to retrieve the context?

  • @kdu97
    @kdu97 Год назад

    Thank you!!!

  • @SuperOazy
    @SuperOazy 2 года назад

    Perfect; thanks a lot.

  • @egulsever
    @egulsever 11 месяцев назад

    After scaffolding I want to be able to add a new column to Product table following code-first and add-migration. Is that possible?

  • @AbrahamWilson
    @AbrahamWilson 2 года назад

    Hey Patrick, thanks for making another amazing video, I do have a video request, can you make a series on Dapper

  • @lv9479
    @lv9479 Год назад

    Hello, as usually it is very usefull. I got the same problem of object cycle with our oracle database but the swagger is completly stucked in our case. I set the JsonIgnore and it's OK.

  • @rajeshkubhardwaj
    @rajeshkubhardwaj Год назад

    Scaffold-DbContext command with sybase database for NET 6 Database First Approach ?

  • @thedude6810
    @thedude6810 11 месяцев назад

    That was helpful

  • @mohammadmaninang3766
    @mohammadmaninang3766 Год назад

    I have a existing database with tables but those tables will not be part of the project. Should I use code first or database first but the requirement is to use that database. I was wondering if I use code first will it delete the other tables??

  • @delightful730
    @delightful730 9 месяцев назад

    Need Get Data from Multiple Tables with join Query, DB First Approach, MVC, Not Repository Parrten

  • @prabhagarann840
    @prabhagarann840 11 месяцев назад

    Using database first approach can we create a new database which has the schema of existing database? if that's possible can u make one vedio?

  • @mdarif-rt9mg
    @mdarif-rt9mg 2 года назад

    Hi Patrick, would be interested to if you can show us demo on building api using Db first ef core as i would like to expose the data from oracle database , basically to a thrid party using basic authentication.

  • @HeinzBigler
    @HeinzBigler 2 года назад +1

    Interesting video. What about Stored Procedures, what would be the best practice here? Migrate them to C# methods?

    • @PatrickGod
      @PatrickGod  2 года назад

      Hey Heinz, it seems this might be a good option. EF Core seems to be very limited regarding stored procedures. For instance you can only return Entities and you can't use Joins in your stored procedure according to the documentation. Hope this helps! Take care, Patrick

    • @joecasa19
      @joecasa19 2 года назад +1

      I personally would create custom entities to receive the output of stored procs that return data and then use the open source package Dapper to call execute the procedures.
      You can still use your DbContext connection to execute the procedures. For stored procs that perform operation but don't return anything, Execute with Dapper again using your DbContext connection.
      You don't get the benefits of caching that EF gives you but compared to the huge boost in performance, just remember and be aware that you should recycle the DbContext before doing an EF query where the execution of your stored proc may have altered the data that was previously retrieved by EF.
      If everything your app needs to do with the DB is already written as views and stored procs, consider had rolling your entities and use Dapper instead of bringing EF into the mix. Your users will appreciate the performance difference.

  • @memoriesofold9591
    @memoriesofold9591 Год назад

    what if I add another table in the database, how can I update the scaffold to insert the new table?

  • @fadyosama4642
    @fadyosama4642 Год назад +1

    thanks helpful vid

  • @sahitkarale
    @sahitkarale Год назад

    How do I scaffold using IdentityDbContext instead of DbContext because I want to use some of IdentityDbContext features

  • @normanaranez323
    @normanaranez323 Год назад

    do you have any idea how to create multiple database base on tenant or subdomain? i mean if we select tenant/subdomain use database intended for that. thanks

  • @Dartarok999
    @Dartarok999 2 года назад

    patrick god, could you help me, making a video explaining how to save multiple files with inputfile but save them in a local folder and show that local path in the database, it would be very helpful since I've been trying for a long time...with blazor webassembly

  • @sagarmajumdar92
    @sagarmajumdar92 2 года назад

    Hi Patrick.
    Will you be making a tutorial on dotnet Web API Versioning and configuring Swagger for versioning ?

  • @vtminhlien8840
    @vtminhlien8840 2 года назад

    Now let work with session to build simple admin web, tks you very much

  • @marshallnyamadzawo8553
    @marshallnyamadzawo8553 Год назад

    How do you create a view with code first?

  • @MohammadKomaei
    @MohammadKomaei 2 года назад

    This is not a good reason to use code first , we can set a setting just one place in program.cs file:
    builder.Services.AddControllersWithViews()
    .AddControllers(options => options.JsonSerializerOptions.ReferenceHandler = ReferenceHandler.IgnoreCycles);

  • @angelcasanchez7229
    @angelcasanchez7229 2 года назад

    patrick a video about code first migration minute 19:47 please thank you very much

  • @borissisi3673
    @borissisi3673 Год назад

    so sNice tutorialt like that

  • @schwifty0554
    @schwifty0554 2 года назад

    Hi thanks for the vid,
    can you have 2 db connections ?

  • @princesarno2652
    @princesarno2652 Год назад

    Mine looks notNice tutorialng like the way you guys started it would be amazing if soone told how to get the multiple tracks

  • @jdelgado1025
    @jdelgado1025 2 года назад

    Is an updated version of the Full Stack class coming out soon using .NET 6 and EF6?

    • @PatrickGod
      @PatrickGod  2 года назад +1

      It's here: ruclips.net/video/K23uJdMiEpk/видео.html Enjoy! 😄

  • @lahirurandika6141
    @lahirurandika6141 2 года назад

    Where can I get the DB sql file?

  • @user-yy7nf4sh8f
    @user-yy7nf4sh8f 8 месяцев назад

    wheres the file for the database table

  • @jndsdk
    @jndsdk Год назад

    🎉🎉🎉🎉❤❤❤

  • @ahmetkeskin2462
    @ahmetkeskin2462 9 месяцев назад

    11.20

  • @printagencia565
    @printagencia565 Год назад

    hahsdhahah good

  • @Denvercoder
    @Denvercoder 2 года назад

    This guy really has a “God” complex. 😂😂😂