CRUD with Dapper in a .NET 6 Web API using SQL Server 🚀

Поделиться
HTML-код
  • Опубликовано: 2 ноя 2024

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

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

    The first 1,000 people to use the link will get a 1 month free trial of Skillshare: skl.sh/patrickgod06221 🚀

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

    Thank you Patrick, I was eagerly waiting for this.

  • @Artmageddon
    @Artmageddon 2 года назад +6

    I have to say I've been a fan of Dapper and was waiting for something like this for a long time! Keep up the great work!

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

    One good thing I realised about Dapper over EF core is that when you use it in your portfolio projects for interviews, it proves that you understand at least the basics of SQL as opposed to just using LINQ and treating the SQL Server as a black box.

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

    ive been trying to find a basic crud api with dapper for almost 3 days and finally, you saved me bro.

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

      Glad I could help! Thanks for your feedback! 😊

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

    Thank you so much, for creating this.

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

    Dapper !!! that what i am waiting for. Thanks you are reading my mind 😊😊

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

    This is soo quick and its working.... Thank You.

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

    Thank you Patrick! 😁

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

    Hi Patrick, thanks for this wonderful and informative video. Really appreciate man. ❤

  • @edwintorres2577
    @edwintorres2577 2 года назад +3

    It looks nice with that simple exercise but how about handle CRUD with multiple tables and using Commit and Rollback and Stored Procedures. Thnx a lot Patrick!!!!

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

    Thank you for the helpful video! You made everything easy to follow understand

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

    Thank you patric. luv this episode

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

    Thanks ! Very good !!

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

    Thank you Patrick, good content.

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

    Thank you. Just an FYI, one issue that came up in the last company I worked at for 5 years was when they decided to go with "Dapper", there were "concurrency issues" that arose.
    We had to go back and address that. We had to do "special coding" to handle concurrency issues". Can you create an additional video that shows how to handle "concurrency issues" that can arise when using Dapper to do update operations ?

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

    Great. Thanks very much!

  • @Mo-ef9yt
    @Mo-ef9yt 2 года назад

    nice walkthrough

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

    Thank you for the video. Do you have a follow up video that shows calling the Dapper API in razor pages simple CRUD application? That will be very helpful to see the whole thing in action.

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

    Thanks man, you're save me!!!

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

    Thanks for sharing, but I think it would add a lot if you used interfaces and services, put the connection string on it's own class and injected in the program.cs and create the store procedures in sql, writing sql statements on visual studio is a huge open door for sql injection, you are a good teacher, but it would be much better if you would show complete examples of the tools, just a comment

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

    Very useful for me

  • @King-Merlin
    @King-Merlin Год назад

    please a full stack video with dapper would be great

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

    When you reached the update saying that's it, I said where where where 😆😆, but then you noticed it was missing 😆😆

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

    Thanks!

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

    SQL query to create and insert initial data:
    CREATE TABLE SuperHeroes (
    Id INT PRIMARY KEY IDENTITY(1,1),
    Name VARCHAR(MAX) NOT NULL,
    FirstName VARCHAR(MAX) NOT NULL,
    LastName VARCHAR(MAX) NOT NULL,
    Place VARCHAR(MAX) NOT NULL
    );
    Insert Into SuperHeroes (Id, Name, FirstName, LastName, Place) Values (1, 'Spider-Man','Peter', 'Parker', 'New York City');

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

    what amazing you are
    thanks

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

    Thank you

  • @alexandrelimanogueira
    @alexandrelimanogueira 2 года назад +3

    Dapper > Entity

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

    Can any one suggest? Dapper or EFCore? & Why?

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

    I used to use Dapper all the time until I discovered IQueryable with EF Core. This one feature made me switch from Dapper straight away.
    I see a lot of people asking, on the Dapper GitHub, for similar dynamic querying but the point for Dapper is you controller all aspects of the SQL query and its not auto generated the way EF Core does it for you.

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

      Dapper can generate SQL with Dapper.Rainbow or Dapper.Contrib, though not for every database.

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

      Yes who needs performance or control - EF is fine 🤡
      You can do all that stuff with Dapper.Contrib.

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

    Dapper is God

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

    Hi Patrick great video,
    I was wondering could've you use string interpolation in GetById endpoint so the query would go like:
    var hero = await connection.QueryFirstAsync($"select * from testing where id = {heroId}");

  • @luis.e.moreno
    @luis.e.moreno 2 года назад

    Hey Patrick! Thank you, this video is pretty good! Could you please make one about DTOs? Thanks again!

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

    Hi Patrick,
    Great tutorials, they have help me quite a bit. I wanted to know if there will be a wasm server/client side logging tutorial?

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

    I've tried to use the path [HttpGet("{Id}"] instead of [HttpGet("{heroId}")] but it didn't worked. Can someone explain me why, please.

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

    Loved the video Patrick. Could you tell me how easy would it be to swap the sqldb for a sqlite one please?

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

      Thanks, Tom! I think you only have to change the connection string. 😊 Hope this helps!

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

    Hi Patrick, I believe I can replace the coded sql with a stored procedure call for it to as well work

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

    This is great, I already use this method with MS SQL and Entity Framework Core but what I miss, can you please make some tutorial what is thd best way with authorization user from Blazor (Server) and API like this? I have some method done but I am not sure if it is 100% correct

  • @Trinita75
    @Trinita75 2 года назад +5

    Dapper is much better then Ef !

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

    i still follow you even you didnt configure VS to use _config by default when creating a ctor :D

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

    How about a tutorial using Winforms One to many data entry forms

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

    Dapper is absolutely great!
    I have always felt that using a library (Entity Framework) to generate a language (SQL) was a bit of a code smell. Will the library know to use vendor-specific features, like rowids in Oracle or send multiple queries in a single pass, like Dapper does with QueryMultiple?
    It often doesn't matter with low-usage software, but when it does matter, I find I have to work around the quirks of the library, and often have to bypass it altogether. This is a design decision like any other, but once you get good with Dapper and if you use only 1 or 2 DBMSs most of the time, it's hard to beat both its developer efficiency and transactions-per-second efficiency.

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

      sameee
      using EF is just adding a whole lot complexity to your program even if you just need a simple read table, also not all EF works flawlessly in every database provider except ms sql
      our company primarily use oracle ebs, in conjunction with mssql and mariadb, using EF for 3 different DB in one program making it difficult for other dev to maintain and learning EF's concepts of repositories, unit of work, etc is taking a lot of time
      since i'm also oracle developer i always prefered to write raw query syntax, using EF means a lot of mental overhead for more complex queries. If I want to do queries that have a lot of HAVING conditions or stuff like NOT IN (subquery) you're basically hacking the LINQ syntax until it generates sane SQL statements. It's a leaky abstraction layer. Like your C code of an algorithm looks like an efficient solution but you need to completely rewrite it because the compiler turns the assembler output into a mess.

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

    how can I use sp?. pls tell me

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

    System.Data.SqlClient isn't a correct one it's discontinued. Microsoft.Data.SqlClient is the most recent packet.

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

    How can I download these sources ?

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

      Here's the repository: github.com/patrickgod/DapperCrudTutorial Enjoy!

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

      @@PatrickGod thanks! Congratulations for the videos.

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

    hi plz create crud with CQRS and Mediator

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

    I dont't believe to dapper about security... nevertheless thnx patrick

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

      What? Dapper is used by some of the largest corporations and most notable software projects. It was written by StackOverflow.com.
      Additionally, it has nothing to do with security other than that it makes SQL parameterization easier, which eliminates a common security hole owned by database programming beginners.

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

      dapper is an helper for object mapping nothing related with security
      if you talking about sql injection, then you should always use parameters
      NEVER write your sql syntax like this
      string sql = "select * from user where username = '" + user_name + "'";

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

    so silly video, u cant delete superhero. because its superhero.