crud operation in web api net core with EF Core & Swagger

Опубликовано: 23 Март 2026
на канале: DotNet Techy
3,495
55

Hi Everyone,
Welcome to DotNetTechy YouTube Channel.

Crud operations with EF Core Web API
What you are going to learn
How to create web api in .net core
How to use code first approach in EF Core
How to use swagger ,to test our api

How to achieve it ?
Create API using VS 2019/ 2017
Create Models
Create API Controller & DbContext
Build project
Install Swagger
Test restful api using swagger

Questions ?
You can comment on my video.
Happy to help you.
Important Commands:
using Microsoft.OpenApi.Models

ConfigureServices:
// Register the Swagger generator, defining 1 or more Swagger documents
Configure:
// Enable middleware to serve generated Swagger as a JSON endpoint.
Add Initial Migrations:
Add-Migration InitialCreate

Update Database:
Update-Database

More about using swagger in dot net core from Microsoft docs:
ASP.NET Core web API help pages with Swagger / OpenAPI
When consuming a Web API, understanding its various methods can be challenging for a developer. Swagger, also known as OpenAPI, solves the problem of generating useful documentation and help pages for Web APIs. It provides benefits such as interactive documentation, client SDK generation, and API discoverability.

In this article, the Swashbuckle.AspNetCore and NSwag .NET Swagger implementations are showcased:

Swashbuckle.AspNetCore is an open source project for generating Swagger documents for ASP.NET Core Web APIs.

What is Swagger / OpenAPI?
Swagger is a language-agnostic specification for describing REST APIs. The Swagger project was donated to the OpenAPI Initiative, where it's now referred to as OpenAPI. Both names are used interchangeably; however, OpenAPI is preferred. It allows both computers and humans to understand the capabilities of a service without any direct access to the implementation (source code, network access, documentation). One goal is to minimize the amount of work needed to connect disassociated services. Another goal is to reduce the amount of time needed to accurately document a service.