Skip to content

guilhermebernava/ApiDapper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

💫 ApiDapper 💫

A basic API for CRUD operations on PERSONS using Dapper and SQL Server


⚙️ Prerequisites

Before running this project, make sure you have the following:

  • .NET 6 SDK
  • Visual Studio or your preferred IDE
  • SQL Server
  • Create a database named DapperDb
  • Create a PERSONS table in SQL Server
  • Create the person_get_by_id stored procedure

🚀 Getting Started

Create the Database

CREATE DATABASE DapperDb;

Create the Persons Table

CREATE TABLE [dbo].[Persons] (
  [Id] UNIQUEIDENTIFIER NOT NULL,
  [Name] NVARCHAR(255) NOT NULL,
  [Surname] NVARCHAR(255) NOT NULL,
  [Age] INT NOT NULL,
  [Gender] NVARCHAR(10) NOT NULL,
  [Birthday] DATETIME NOT NULL,
  PRIMARY KEY CLUSTERED ([Id] ASC)
);

Create the Procedure person_get_by_id

CREATE PROCEDURE person_get_by_id
  @Id UNIQUEIDENTIFIER
AS
BEGIN
  SELECT * FROM [dbo].[Persons] WHERE [Id] = @Id;
END;

After running these SQL commands, update the DefaultConnection in appsettings.json to your database connection string and then run the API.

🛠️ Technologies Used

  • .NET 6
  • Dapper
  • SQL Server
  • Repository Pattern
  • Stored Procedures
  • Clean Code
  • IMemoryCache

About

A basic CRUD API for study dapper and procedures

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published