Giter Site home page Giter Site logo

commenter_efcore's Introduction

Commenting system using EF Core 5 and PostgreSQL

Commenting system backend where we can -

  1. Register and login user
  2. Create, Read, Update and Delete Posts and Comments

3 main entities into play -

  • User
{
    "first_name": "John",
    "last_name": "Doe",
    "gender_abbreviation": "M",
    "date_of_birth": "1970-01-01T09:30:00",
    "phone": "1234567890",
    "username": "johndoe123",
    "email": "[email protected]",
    "password": "1234567890",
    "compare_password": "1234567890"
}
  • Post
{
    "title": "My first post",
    "body": "Post body",
    "user_id": 1
}
  • Comment
{
    "body": "My first comment on the first post",
    "user_id": 1,
    "post_id": 1
}

Steps to recreate

  1. Scaffold the project structure
mkdir src
cd src
dotnet new webapi -o Api

dotnet new classlib -o Core
dotnet new classlib -o Infrastructure

cd ..
dotnet new sln
dotnet sln add .\src\Api
dotnet sln add .\src\Core
dotnet sln add .\src\Infrastructure
  1. Build connection string based on NPGSQL docs

  2. Install the following nuget packages -

AutoMapper.Extensions.Microsoft.DependencyInjection -> For AutoMapper (Api)
Npgsql.EntityFrameworkCore.PostgreSQL -> EF Core for PostgreSQL (Infrastructure)
Microsoft.EntityFrameworkCore.Tools -> EF Core Tools (Api)
LinqKit.Microsoft.EntityFrameworkCore -> For building predicate expression trees for EF Core 5 (Infrastructure)
BCrypt.Net-Next -> For password hashing using BCrypt Algorithm (Infrastructure)
EntityFrameworkCore.Exceptions.PostgreSQL -> For catching PostgreSQL exceptions in .NET friendly way(Core)
  1. Apply the migrations
Add-Migration InitialDbCreation
Update-Database
  1. Add business logic

  2. Postman collection and environment variable.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.