Skip to content

widbernadus/simple_crud_net6

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Simple crud in ASP.Net 6 using Dapper to interact with SQL Server database

this is a simple example implementation of Dapper using netcore 6, hope you enjoy it!

NuGet Package requirements :

  • Dapper 2.1.15
  • System.Data.SqlClient 6.0.16

General Information

  • Theme installed: AdminLTE 3.2.0
  • Database: Microsoft SQL Server

Open query editor connected to your database, copy this query below then execute each query

Book table
CREATE TABLE [dbo].[book](
	[id] [int] IDENTITY(1,1) NOT NULL,
	[title] [text] NULL,
	[author] [varchar](150) NULL,
	[publisher] [varchar](150) NULL,
	[year] [int] NULL,
	[ref_genre_id] [int] NULL
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]

Genre reference table

CREATE TABLE [dbo].[ref_genre](
	[id] [int] IDENTITY(1,1) NOT NULL,
	[genre] [varchar](50) NULL
) ON [PRIMARY]

Manually seeding the database
INSERT INTO ref_genre (genre) VALUES
('Fantasy'),('Science Fiction'), ('Adventure'),
('Romance'),('Horor'), ('Biography')

Congratulations! This is the final step. Clone the repository, install Nuget Package requirement then configure the database connection. Then, run it!

Releases

No releases published

Packages

No packages published

Languages