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.
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!!!!
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 ?
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.
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
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');
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.
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}");
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
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.
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.
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.
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 + "'";
The first 1,000 people to use the link will get a 1 month free trial of Skillshare: skl.sh/patrickgod06221 🚀
Thank you Patrick, I was eagerly waiting for this.
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!
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.
ive been trying to find a basic crud api with dapper for almost 3 days and finally, you saved me bro.
Glad I could help! Thanks for your feedback! 😊
Thank you so much, for creating this.
My pleasure! 😊
Dapper !!! that what i am waiting for. Thanks you are reading my mind 😊😊
You're welcome 😊
This is soo quick and its working.... Thank You.
Thank you Patrick! 😁
Hi Patrick, thanks for this wonderful and informative video. Really appreciate man. ❤
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!!!!
Thank you for the helpful video! You made everything easy to follow understand
Thank you patric. luv this episode
Thanks ! Very good !!
Thank you Patrick, good content.
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 ?
Great. Thanks very much!
nice walkthrough
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.
Thanks man, you're save me!!!
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
Very useful for me
Glad to hear that!
please a full stack video with dapper would be great
When you reached the update saying that's it, I said where where where 😆😆, but then you noticed it was missing 😆😆
Thanks!
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');
what amazing you are
thanks
Thank you
Welcome!
Dapper > Entity
Can any one suggest? Dapper or EFCore? & Why?
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.
Dapper can generate SQL with Dapper.Rainbow or Dapper.Contrib, though not for every database.
Yes who needs performance or control - EF is fine 🤡
You can do all that stuff with Dapper.Contrib.
Dapper is God
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}");
Hey Patrick! Thank you, this video is pretty good! Could you please make one about DTOs? Thanks again!
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?
I've tried to use the path [HttpGet("{Id}"] instead of [HttpGet("{heroId}")] but it didn't worked. Can someone explain me why, please.
Loved the video Patrick. Could you tell me how easy would it be to swap the sqldb for a sqlite one please?
Thanks, Tom! I think you only have to change the connection string. 😊 Hope this helps!
Hi Patrick, I believe I can replace the coded sql with a stored procedure call for it to as well work
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
Dapper is much better then Ef !
Agree
i still follow you even you didnt configure VS to use _config by default when creating a ctor :D
Thanks! 😅
How about a tutorial using Winforms One to many data entry forms
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.
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.
how can I use sp?. pls tell me
System.Data.SqlClient isn't a correct one it's discontinued. Microsoft.Data.SqlClient is the most recent packet.
How can I download these sources ?
Here's the repository: github.com/patrickgod/DapperCrudTutorial Enjoy!
@@PatrickGod thanks! Congratulations for the videos.
hi plz create crud with CQRS and Mediator
I dont't believe to dapper about security... nevertheless thnx patrick
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.
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 + "'";
so silly video, u cant delete superhero. because its superhero.