/aspnet-core-web-api-demo

Simple ASP.Net Core 3 Web API App

Primary LanguageC#

ASP.Net Core Web API Demo

This is simple ASP.Net Core 3.1 Web API Application having some common features that required by allmost Web API app.

Feel free to Fork/PR.

Features


  • ASP.Net Core 3.1
    • Model Validations
    • Dynamic Service Register
    • Localization
  • Authentication
    • Asp.Net Core Identity
    • JWT based Auth
    • Custom User/Roles
  • Entity Framework Core 3.1
    • Code First Approach
    • Unit of Work with Repository
    • Automatic Seeding
  • Third-party
    • Swagger
    • Auto Mapper
    • Logs with NLog
    • Mail send with SendGrid
  • Deploy
    • CI GitHub Actions
    • Deploy on Heroku
    • Use Docker

Commands for SQL Server Migration


  1. Open src folder
    cd src
    
  2. Add Migration
    dotnet ef migrations add <Migration name> -o "Migrations" -p "DemoApp.EntityFramework" -s "DemoApp.API" -c "AppDBContext"
    
  3. Update Database
    dotnet ef migrations update <Migration name> -o "Migrations" -p "DemoApp.EntityFramework" -s "DemoApp.API" -c "AppDBContext"
    
  4. Remove Last Migration
    dotnet ef migrations remove -p "DemoApp.EntityFramework" -s "DemoApp.API" -c "AppDBContext"
    
  5. Generate full Script for all Migrations
    dotnet ef migrations script -i -v -o script.sql -o "Migrations" -p "DemoApp.EntityFramework" -s "DemoApp.API" -c "AppDBContext"
    

Project Dependency


               API
                ↑
             Business
                ↑
            DataAccess
                ↑
            AutoMapper
                ↑
              Models
         🡕              🡔
EntityFramework     Localization

Setup


  1. Download this Repo.
  2. Update AppSettings.json file Under API project.
  3. Create App on Heroku.
  4. Add Secrets in GitHub.
    • HEROKU_API_KEY
    • HEROKU_APP_NAME
  5. Create & Push repo on Github.
  6. Open your Heroku App page.

That's it! 😎