Dotnet Core Api CRUD With Dapper and PostgreSql

dapper and postgres

💻Source Code: https://github.com/rd003/PostgressDapperDemo

Tools and technology used

  • VS Code (editor)
  • .Net 8
  • Postgres
  • Dapper

Let’s get started with creating the database first.

create database PersonDb;

Now, create a table within the database.

create table Person
(
 Id serial primary key,
 Name varchar(30) not null,
 Email varchar(30) not null
);

To create a new project you need to run these commands in a sequence.

> dotnet new sln -o PostgressDapperDemo

> cd PostgressDapperDemo

> dotnet sln add .\PostgressDapperDemo\

> code . #this command will open this project in the vs code

Nuget packages

Install the following nuget packages.

[Read More]

Write dapper effectively with generic methods

Dapper tutorial with dotnet core

Dapper is a micro ORM for database connectivity in dotnet and it’s been around for quite a while. It is loved by most of the developers because of its simplicity and performance.

Why dapper?

With the help of dapper you can quickly access the data without writing too much code. It performs very well because we directly write queries and executes them. Developers who loves to work with queries and for the projects, where performance really matters where you wants to write very optimized queries, dapper can be the good choice.

[Read More]