GithubHelp home page GithubHelp logo

customers's Introduction

Customers

The customers solution consists of the following projects,

Customers.DAL

The data access layer is a .NET Standard 2.0 library that makes use of EF Core 2.1 using a code first approach in order to create the database through model - classes.

Customers.DTOs

A .NET Standard 2.0 library that contains Data Transfer Objects that will be used for moving data between layers (DB to API).

Customers.Services

A .NET Standard 2.0 library that encapsulates the DBContext class of the DAL in order to provide Database Operations upon the Customers table. Also contains a custom defined exception and Profiles used by AutoMapper. (we could create a Customers.Common Library actually!)

Customers.Api

A .NET Core 2.1 Web Api with a Controller(CustomersController) that servers the requests of GET, PUT, POST, DELETE for the basic operations upon the Customers Entity.

Customers.Api.Tests

An xUNIT .NET Core 2.1 Test project with Test methods upon CustomersController that uses the In Memory Database of Entity Framework in order to provide an instance of the Database.

NUGET Packages used:

  • Entity Framework Core v2.1.4
  • Pomelo.EntityFrameworkCore.MySql v2.1.2 (MySQL provider for Entity Framework Core)
  • AutoMapper v7.0.1 (A convention-based object-object mapper.)
  • Swashbuckle.AspNetCore v3.0.0 (Swagger tools for documenting APIs built on ASP.NET Core)
  • NLog.Web.AspNetCore v4.7.0 (Logging Support)

How To Use/Debug/Test

For starters clone or download the source through https://github.com/CBidis/Customers.git

Before opening the solution through VS 2017 you need to validate that you have at least version 15.7.5 and .NET Core 2.1 SDK!

Upon completion of the prerequisites and opening the solution though visual studio before running the application you have to setup the connection string of MySQL Database, the connection string resides in appSettings.json file.

{
  "Logging": {
    "LogLevel": {
      "Default": "Warning"
    }
  },
  "ConnectionStrings": {
    "MySQLConn": "server=localhost;database=CustomersDB;uid=root"
  },
  "AllowedHosts": "*"
}

After succesfully setting the connection string you have to apply the latest migration through the Package Manager console by running the command update-database with default project set to Customers.Api.

In case you have problems by running the migrations or you have issues with MySQL Database you can always use the InMemory Database by changing the following line of the Startup.cs

From:

            services.AddDbContext<CustomerDBContext>(opt =>
                            opt.UseMySql(Configuration.GetConnectionString("MySQLConn")));

To:

            services.AddDbContext<CustomerDBContext>(opt =>
                            opt.UseInMemoryDatabase("InMemoryCustomers"));

customers's People

Contributors

cbidis avatar

Watchers

 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.