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
CREATE DATABASE DapperDb;
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 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.
- .NET 6
- Dapper
- SQL Server
- Repository Pattern
- Stored Procedures
- Clean Code
- IMemoryCache