Giter Club home page Giter Club logo

aspnetcore.ntier's Introduction

Asp.Net Core Web API N-Tier

.NET Core N-Tier architecture Web Api sample project.

Give a Star ⭐️

If this repository helped you please consider giving a star! Thanks!

Setup

  • SQLite has been used as database
  • You can change connection string from appsettings.json within aspnetcore.ntier.API
  • Apply database migrations to create the tables. From a command line :

Go into aspnetcore.ntier.DAL class library. Please make sure proper versions of .NET SDK and dotnet-ef tool has been installed

cd aspnetcore.ntier.DAL

Apply database changes. If you are using SQLite then database file with .db extension should be created inside aspnetcore.ntier.API project

dotnet ef --startup-project ../aspnetcore.ntier.API database update --context AspNetCoreNTierDbContext

Authentication

  • Authentication has been added for version 2 endpoints.
  • Non auth endpoints require JWT token to be provided otherwise 401 response will be returned
  • So you have to login or register first in order to get the JWT token then add it to the header while sending a request. It can be done by:
    • Clicking lock icon next to the particular endpoint and pasting token in the textbox on swagger page
    • Adding token for the Authorization header of the request
  • You can disable authentication for endpoints by removing Authorize attribute from the particular controller

Versioning

  • URL versioning has been implemented and currently there are 2 versions.
  • Versions can be changed via Swagger page or by providing version number in the URL.

Logging

  • Structured logging using Serilog has been implemented.
  • Currently logs are being added to file and console.
  • You can change or find the settings in appsettings.json.
  • In UserService there examples of formatting the log message or using different levels of logging
  • Logging will be improved over time.

Layers

  • aspnetcore.ntier.API - Presentation Layer is type of .Net Core Web API project.
  • aspnetcore.ntier.BLL - Business Logic Layer responsible for data exchange between DAL and Presentation Layer.
    • It has Services, AutoMapperProfiles and CustomExceptions in it
  • aspnetcore.ntier.DAL - Data Access Layer responsible for interacting database. Generic repositories have been used.
    • Database context, repositories and database entity models are located in this class lib
  • aspnetcore.ntier.DTO - Data transfer objects are added here
  • aspnetcore.ntier.Test - Unit and Integration tests are created here

Development process

You can follow the steps during development from the commit list.

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Support

If you found this project useful or interesting and would like to support my work you can support me. Thanks!

Buy Me A Coffee

aspnetcore.ntier's People

Contributors

aghayeffemin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

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.