Building the ASP.NET API app

Basics taken from the video: "Building Secure Web APIs with ASP.NET Core"

Setting Up a .NET Core Server With Entity Framework Core Using a PostgreSQL Database

Using Swagger UI

Swagger UI is a framework for testing RESTful API.

From the source video: Installing and using Swagger

In `Startup.cs` add:

        public void ConfigureServices(IServiceCollection services)
            // Add framework services.
            // !!! ADD THOSE LINES:
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
            // !!! ADD THOSE LINES:

In order to test it go to:

(for me it didn't work without the `index.html`)


From the source video: Authorization part.

If we don't want to use Azure or Gmail accounts, we'll have to use OpenIdDict (github project for Core here) to provide the tokens.

Blog: "Setting up ASP.NET v5 (vNext) to use JWT tokens (using OpenIddict)":

…and this is the complete code from the tutorial:

Dapper micro-ORM

Video: "ASP.NET MVC - Dapper, Areas, and Layouts"

Blog: "Use Dapper.NET ORM in ASP.NET MVC"

As for today, the MySQL connector for .Net Core is not ready yet. Available options are either PostgreSQL or SQLite.

Microsoft's Internal REST API Design Guidelines



Installation on Windows (set speed at x2):

How To Create A Postgres Database Using pgAdmin (from Postgres official channel):

Change PostgreSQL errors from French to English


Change this part of the file "postgresql.conf" (in my case it was under "C:\Program Files\PostgreSQL\9.5\data\postgresql.conf"), and then restart the server (Services -> postgresql-x64-9.5 -> Restart):

# These settings are initialized by initdb, but they can be changed.
lc_messages = 'English_United States.1252'  # locale for system error message

# strings
lc_monetary = 'English_United States.1252'  # locale for monetary formatting
lc_numeric = 'English_United States.1252'   # locale for number formatting
lc_time = 'English_United States.1252'      # locale for time formatting

# default configuration for text search
default_text_search_config = 'pg_catalog.english'

Arguments for PostgreSQL » MySQL

(from the Postgres wiki) Why do you want to migrate?

There are different reasons why a user wants to migrate. Mostly for migrations from MySQL to PostgreSQL it is one of the following:

  • performance reasons
  • stableness
  • reliability
  • GIS
  • Replication issues
  • Cluster issues
  • High availability issues
  • localisation/globalisation issues
  • need of object relational features
  • sick of bugs
  • costs for license (dual license, GPL)
  • license (BSD instead of GPL)

Ten Reasons Why You Should Prefer PostgreSQL to MySQL:

What PostgreSQL has over other open source SQL databases:
"If you do anything with spatial data, PostgreSQL with PostGIS is the way to go."

Technical comparison between both:

Video: "PostgreSQL vs. MySQL - Pros & Cons"

Migrating MySQL to PostgreSQL

Video: "Large Scale MySQL Migration to PostgreSQL"

Info taken from the PostgreSQL wiki.

Using the Migration Toolkit (from EntrepriseDb)

Free tool:

Extract the files from the zip and fun the installer (`ppasmeta-`) as administrator.

To enable MySQL connectivity, download MySQL's freely available JDBC driver from:

Place the `mysql-connector-java-5.0.8-bin.jar` file in the "JAVA_HOME\jre\lib\ext" directory (in my case: "C:\Program Files\Java\jre1.8.0_60\lib\ext\mysql-connector-java-5.0.8-bin.jar").

The Migration Toolkit documentation can be found here (online doc) or here (pdf version).

First: modify `C:\Program Files\PostgresPlus\edbmtk\etc\` (Info):



Then: execute `C:\Program Files\PostgresPlus\edbmtk\bin\runMTK.bat` (Info).

runMTK.bat -sourcedbtype mysql -targetdbtype enterprisedb -allTables YOUR_DB_SCHEMA

// ...or with a limited subset of tables:

runMTK.bat -sourcedbtype mysql -targetdbtype enterprisedb -tables TABLE1,TABLE2,TABLE3 YOUR_DB_SCHEMA

In order to get this subset of tables from MySQL:

    TABLE_SCHEMA = 'your_db_name'

For further problems, read my own StackOverflow post here.

API deployment

Video: "Deploying ASP.NET Core Applications"

Want to learn more about Docker? Take the "hands on" course at .

Pending links

Introduction to Dependency Injection in ASP.NET Core

ASP.NET Core ASP.Net 5 Tutorial for Beginners

Z2P C# ASP.NET MVC - Dapper, Areas, and Layouts

RabbitMQ is open source message broker software (sometimes called message-oriented middleware) that implements the Advanced Message Queuing Protocol (AMQP).


Becoming a Wikidot member is free and easy: create an account.

You have to be a Wikidot member to add comments to a Wikidot blog.

Add a New Comment