<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Rohit Ramname</title>
    <description>The latest articles on DEV Community by Rohit Ramname (@rramname).</description>
    <link>https://dev.to/rramname</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F411767%2Fd9f822bb-0799-4756-af30-4772b0c52f1f.jpg</url>
      <title>DEV Community: Rohit Ramname</title>
      <link>https://dev.to/rramname</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/rramname"/>
    <language>en</language>
    <item>
      <title>Read properties of Json object and its values dynamically in Angular/JavaScript</title>
      <dc:creator>Rohit Ramname</dc:creator>
      <pubDate>Mon, 29 Mar 2021 13:35:12 +0000</pubDate>
      <link>https://dev.to/rramname/read-properties-of-json-object-and-its-values-dynamically-in-angular-javascript-3db2</link>
      <guid>https://dev.to/rramname/read-properties-of-json-object-and-its-values-dynamically-in-angular-javascript-3db2</guid>
      <description>&lt;p&gt;Hello Friends,&lt;/p&gt;

&lt;p&gt;Today we are going to see how to read properties of a Json object dynamically and display it using a common component in Angular.&lt;/p&gt;

&lt;p&gt;I ran into a situation where I was required to display contents from different sources in a tabular format on the same screen. These sources had different data structures.&lt;br&gt;
To meet this requirement technically, I decided to create a common component in angular which would access the data, derive the headers and show it on the UI. This way, I did not have to create different components for each data structure and also, I can use the same CSS across the board.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;I am using a portal called  &lt;a href="https://stackblitz.com/" rel="noopener noreferrer"&gt;Stackblitz &lt;/a&gt; which is an excellent portal for angular/react/javasript hands-on. It sets up everything out of the box and you are basically ready to write first line of code without much of a headache of going through NPM installs for studying.  Here is what they are offering at this moment&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1616592268847%2Fdj3JfitO0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1616592268847%2Fdj3JfitO0.png" alt="image.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;OK. Lets see the code.&lt;/p&gt;

&lt;p&gt;Lets create a common component &lt;code&gt;table-display.component&lt;/code&gt;  that we will be using to display the data in tabular format.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

import { Component, Input, OnInit } from "@angular/core";

@Component({
  selector: "table-display",
  templateUrl: "table-display.component.html"
})
export class TableDisplayComponent implements OnInit {
  headers: any;
  constructor() {}

  ngOnInit() {
    this.headers = Object.keys(this.items[0]);
  }
  @Input()
  items: any[];
}


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Here, we have an input property items which is an array of any data structure (assuming Json).&lt;/p&gt;

&lt;p&gt;We also have a property called headers in which we will be deriving the headers from the input object.&lt;/p&gt;

&lt;p&gt;The entire magic of this post is this line of code&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

this.headers = Object.keys(this.items[0]);


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;blockquote&gt;
&lt;p&gt;This is not a feature of angular. This is the feature of Javascript, I am just using it in my angular code.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Here we are taking first element from the Json array and getting all keys from it.&lt;/p&gt;

&lt;p&gt;Next we will see the HTML part of it. &lt;/p&gt;

&lt;p&gt;The file table-display.component.html shows the data in tabular format.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

&amp;lt;div&amp;gt;
  &amp;lt;table class="table"&amp;gt;
    &amp;lt;thead class="" style="background-color: lavender;"&amp;gt;
      &amp;lt;tr&amp;gt;
        &amp;lt;th *ngFor="let header of headers"&amp;gt;{{header}}&amp;lt;/th&amp;gt;
      &amp;lt;/tr&amp;gt;
    &amp;lt;/thead&amp;gt;

    &amp;lt;tbody class=""&amp;gt;
      &amp;lt;tr *ngFor="let item of items"&amp;gt;
        &amp;lt;td *ngFor="let header of headers"&amp;gt;
          {{item[header]}}
        &amp;lt;/td&amp;gt;
      &amp;lt;/tr&amp;gt;
    &amp;lt;/tbody&amp;gt;
  &amp;lt;/table&amp;gt;
&amp;lt;/div&amp;gt;


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;In &lt;code&gt;thead&lt;/code&gt;, we are iterating over the headers and creating a header row.&lt;/p&gt;

&lt;p&gt;In &lt;code&gt;tbody&lt;/code&gt; , we are just iterating over items and for each header, we are reading the value using &lt;code&gt;item[header]&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Cool. Now our component is ready to go on any page to display the data. &lt;/p&gt;

&lt;p&gt;Here is an example.&lt;/p&gt;

&lt;p&gt;In my main component, &lt;code&gt;app.component.ts&lt;/code&gt;, I have 3 different data sets as below.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

private GetCustomerData() {
    return [
      {
        name: "John Smith",
        address: "New York City",
        email: "john@nowhere.com",
        phone: "123456789"
      },
      {
        name: "Mark John",
        address: "Los Angeles",
        email: "mark@everywhere.com",
        phone: "789456123"
      },
      {
        name: "Amanda Nester",
        address: "Miami",
        email: "amanda@here.com",
        phone: "85213456"
      }
    ];
  }

  private GetItemData() {
    return [
      {
        name: "Laptops",
        Model: "Surface",
        Price: "$1500"
      },
      {
        name: "Keyboard",
        Model: "Logitec",
        Price: "$50"
      },
      {
        name: "Phone",
        Model: "Galexy S10",
        Price: "$800"
      }
    ];
  }
  private GetWeatherData() {
    return [
      {
        City: "Philadelphia",
        Weather: "Cold",
        "Chance Of Rain": "10%"
      },
      {
        City: "Dallas",
        Weather: "Warm",
        "Chance Of Rain": "50%"
      },
      {
        City: "san Francisco",
        Weather: "Chilli",
        "Chance Of Rain": "0%"
      }
    ];
  }


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;I am assigning them to different properties in the component.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;


  CustomerData: any = this.GetCustomerData();
  ItemsData: any = this.GetItemData();
  WeatherData: any = this.GetWeatherData();



&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Now I can use the same &lt;code&gt;table-display.component.ts&lt;/code&gt; to show the data from all of these data sets by attaching them as &lt;code&gt;input&lt;/code&gt;.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

&amp;lt;p&amp;gt;
  &amp;lt;table-display [items]="CustomerData"&amp;gt;&amp;lt;/table-display&amp;gt;

  &amp;lt;br /&amp;gt;
  &amp;lt;table-display [items]="ItemsData"&amp;gt;&amp;lt;/table-display&amp;gt;

  &amp;lt;br /&amp;gt;

  &amp;lt;table-display [items]="WeatherData"&amp;gt;&amp;lt;/table-display&amp;gt;
&amp;lt;/p&amp;gt;


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Here is the end picture.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1616594045855%2FvKfDMRYBF.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1616594045855%2FvKfDMRYBF.png" alt="image.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Here is the  &lt;a href="https://stackblitz.com/edit/angular-ivy-mjubku?file=src%2Fapp%2Fapp.component.html" rel="noopener noreferrer"&gt;complete code&lt;/a&gt;  on  &lt;a href="https://stackblitz.com/" rel="noopener noreferrer"&gt;stackblitz&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;Hope this helps you.&lt;/p&gt;

&lt;p&gt;Thanks for reading.&lt;/p&gt;

</description>
      <category>angular</category>
      <category>javascript</category>
      <category>json</category>
    </item>
    <item>
      <title>API Gateway and Microservices using Kong and dotnet core in docker</title>
      <dc:creator>Rohit Ramname</dc:creator>
      <pubDate>Mon, 29 Mar 2021 13:33:31 +0000</pubDate>
      <link>https://dev.to/rramname/api-gateway-and-microservices-using-kong-and-dotnet-core-in-docker-3khh</link>
      <guid>https://dev.to/rramname/api-gateway-and-microservices-using-kong-and-dotnet-core-in-docker-3khh</guid>
      <description>&lt;p&gt;Hi Friends,&lt;/p&gt;

&lt;p&gt;If you are reading this, probably you know what an API gateway is and why you need it. If not, below is the shot version as per  &lt;a href="https://www.bing.com/search?q=what+is+an+api+gateway&amp;amp;cvid=47f94c54294945c0a43196e9486877f6&amp;amp;FORM=ANAB01&amp;amp;PC=U531" rel="noopener noreferrer"&gt;whatis.techtarget.com&lt;/a&gt; &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;An API gateway is programming that sits in front of an application programming interface (API) and acts as a single point of entry for a defined group of microservices. Because a gateway handles protocol translations, this type of front-end programming is especially useful when clients built with microservices make use of multiple, disparate APIs.&lt;/p&gt;

&lt;p&gt;A major benefit of using API gateways is that they allow developers to encapsulate the internal structure of an application in multiple ways, depending upon use case. This is because, in addition to accommodating direct requests, gateways can be used to invoke multiple back-end services and aggregate the results.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;In this article, we will &lt;/p&gt;

&lt;h3&gt;
  
  
  1. Create microservies  in dotnet core and host them in a docker container.
&lt;/h3&gt;

&lt;h3&gt;
  
  
  2. Create docker compose file for our microservices
&lt;/h3&gt;

&lt;h3&gt;
  
  
  3. Setup *&lt;em&gt;Kong *&lt;/em&gt; in docker.
&lt;/h3&gt;

&lt;h3&gt;
  
  
  4. Expose services through Kong
&lt;/h3&gt;




&lt;p&gt;Lets start.&lt;/p&gt;

&lt;p&gt;This is the end architecture that we will be achieving after this exercise.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1613616621492%2FG__gkl02d.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1613616621492%2FG__gkl02d.png" alt="image.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We have 2 microservices, one for DC and one for Marvel. We will be hosting those on our internal servers. We will use Kong API Gateway to expose these services to the outside word which will be categories into Web traffic and App traffic. These calls will come to our services through different routes, we and app.&lt;/p&gt;

&lt;p&gt;Below will be my project folder structure.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1613097334484%2F0IzC8uwIq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1613097334484%2F0IzC8uwIq.png" alt="image.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As you can see here, I have 2 folders for 2 microservices that I will be hosting in docker using docker-compse.yaml file.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 1 - Create Microservices
&lt;/h2&gt;

&lt;h3&gt;
  
  
  DC Service
&lt;/h3&gt;

&lt;p&gt;Lets create first microservice, DC. First navigate to the folder "DC" in command prompt and use below command to create an API project.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

dotnet new webapi


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;This should create a basic web api project with WeatherForecast controller.&lt;/p&gt;

&lt;p&gt;Add a new controller &lt;code&gt;JusticeLeague.cs&lt;/code&gt; for our API,&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

using Microsoft.AspNetCore.Mvc;

namespace DC.Controllers
{
    [ApiController]
    [Route("[controller]/[action]")]
    public class JusticeLeague : ControllerBase
    {
        [HttpGet]
        public string Strongest(){
            return "Batman!";
        }
    }
}


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;This is simple HTTPGet API which returns string.&lt;/p&gt;

&lt;p&gt;Add dockerfile which will pull down necessary images, build the project in release mode and start it at port 7001.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

FROM mcr.microsoft.com/dotnet/core/sdk:3.1 AS build-env

WORKDIR /app

COPY ./ ./
RUN dotnet restore DC.csproj

COPY . ./
RUN dotnet publish -c Release -o out

FROM mcr.microsoft.com/dotnet/core/aspnet:3.1
WORKDIR /app
COPY --from=build-env /app/out .
ENV ASPNETCORE_URLS=http://+:7001  
ENTRYPOINT ["dotnet", "DC.dll"]



&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Now lets see if its working fine.&lt;/p&gt;

&lt;p&gt;Run below command to build the docker image for DC service and tag it with name DC&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

docker build -t DC .



&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Lets test it by running it in a container with name dc &lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

docker run -p 7001:7001 --name=dc dc


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Here I am attaching port 7001 on local machine with port 7001 inside the docker container which was specified in our docker file.&lt;/p&gt;

&lt;p&gt;And we can see the swagger page with our API.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1613098266327%2F4NYjMAkTj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1613098266327%2F4NYjMAkTj.png" alt="image.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Marvel Service
&lt;/h3&gt;

&lt;p&gt;Now navigate to the folder "Marvel" in command prompt and run below command to create the API project.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

dotnet new webapi


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Again, this should create a basic web api project with WeatherForecast controller.&lt;/p&gt;

&lt;p&gt;Add a new controller Avengers.cs for our API&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

using Microsoft.AspNetCore.Mvc;
namespace Marvel.Controllers
{
    [ApiController]
    [Route("[controller]/[action]")]
    public class Avengers: ControllerBase
    {
        [HttpGet]
        public string Strongest(){
            return "Iron Man!";
        }
    }
}


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;This is a simple API that returns strongest avenger.&lt;/p&gt;

&lt;p&gt;Now, like we did before, add docker file which will pull down necessary images, build the project in release mode and start it at port 7002.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

FROM mcr.microsoft.com/dotnet/core/sdk:3.1 AS build-env

WORKDIR /app

COPY ./ ./
RUN dotnet restore Marvel.csproj

COPY . ./
RUN dotnet publish -c Release -o out

FROM mcr.microsoft.com/dotnet/core/aspnet:3.1
WORKDIR /app
COPY --from=build-env /app/out .
ENV ASPNETCORE_URLS=http://+:7002  
ENTRYPOINT ["dotnet", "Marvel.dll"]



&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Now lets see if its working fine.&lt;/p&gt;

&lt;p&gt;Run below command to build the docker image for DC service and tag it with name DC&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

docker build -t marvel.



&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Lets test it by running it in a container with name &lt;strong&gt;marvel&lt;/strong&gt;&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

docker run -p 7002:7002 --name=marvel marvel


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Here I am attaching port 7001 on local machine with port 7001 inside the docker container which was specified in our docker file.&lt;/p&gt;

&lt;p&gt;And we can see the swagger page with our API.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1613098334889%2F8hq-sXpnM.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1613098334889%2F8hq-sXpnM.png" alt="image.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Alright!&lt;/p&gt;

&lt;p&gt;At this point,  we have tested our microservices in docker containers with separate docker files.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 2 -  Host services in Docker with Docker Compose
&lt;/h2&gt;

&lt;p&gt;Now, we will create a docker compose file to get rid of these manual invocations.&lt;/p&gt;

&lt;p&gt;Lets create docker-compose.yaml file at the root level and add below content.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

version: '3.7'
services: 
    dcservice:
        container_name: DC
        build: 
            context: ./DC
            dockerfile: dockerfile
        ports: 
          - "7001:7001"
    marvelservice:
        container_name: Marvel
        build: 
            context: ./Marvel
            dockerfile: dockerfile
        ports: 
          - "7002:7002"
networks: 
  default:
    name: kong-comic-net



&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Here we are creating 2 services, DC and Marvel. We are using &lt;strong&gt;context&lt;/strong&gt; feature of the docker file so that we can use the docker files we have created and reside in the respective folders and assign the same ports at the runtime&lt;/p&gt;

&lt;p&gt;One more important thing is we are creating a new network named &lt;strong&gt;kong-comic-net&lt;/strong&gt; and attaching both of these services to it. In later part of this article, I will use the same network for KONG.&lt;/p&gt;

&lt;p&gt;Now lets test this setup again.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

docker-compose build


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;This should build the images for both of these services using their respective dockerfiles. &lt;/p&gt;

&lt;p&gt;And then&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

docker-compose up


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;This should use those images, create container and run those container by exposing port 7001 and 7002.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 3 - Setup KONG in Docker
&lt;/h2&gt;

&lt;p&gt;Kong Gateway (OSS) is an open-source, lightweight API gateway optimized for microservices, delivering unparalleled latency, performance, and scalability.&lt;/p&gt;

&lt;p&gt;Kong Gateway listens for traffic on its configured proxy port(s) 8000 and 8443, by default. It evaluates incoming client API requests and routes them to the appropriate backend APIs. While routing requests and providing responses, policies can be applied via plugins as necessary.&lt;/p&gt;

&lt;p&gt;Lets start with KONG setup.&lt;/p&gt;

&lt;p&gt;Execute below commands in this order to setup KONG with PostgreSQL DB in docker.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;I got these from the  &lt;a href="https://docs.konghq.com/install/docker/#:~:text=%20The%20steps%20involved%20in%20starting%20Kong%20in,Prepare%20your%20declarative%20configuration%20file%0AThe%20syntax...%20More" rel="noopener noreferrer"&gt;official documentation.&lt;/a&gt;  &lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Start your database&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

docker run -d --name kong-database --network=kong-comic-net -p 5432:5432 -e "POSTGRES_USER=kong" -e "POSTGRES_DB=kong"  -e "POSTGRES_PASSWORD=kong" postgres:9.6



&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Prepare your database&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

docker run --rm --network=kong-comic-net  -e "KONG_DATABASE=postgres" -e "KONG_PG_HOST=kong-database" -e "KONG_PG_USER=kong" -e "KONG_PG_PASSWORD=kong"  kong:latest kong migrations bootstrap



&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Start Kong&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

docker run -d --name kong --network=kong-net -e "KONG_DATABASE=postgres" -e "KONG_PG_HOST=kong-database" -e "KONG_PG_USER=kong" -e "KONG_PG_PASSWORD=kong" -e "KONG_PROXY_ACCESS_LOG=/dev/stdout"  -e "KONG_ADMIN_ACCESS_LOG=/dev/stdout"      -e "KONG_PROXY_ERROR_LOG=/dev/stderr"      -e "KONG_ADMIN_ERROR_LOG=/dev/stderr"      -e "KONG_ADMIN_LISTEN=0.0.0.0:8001, 0.0.0.0:8444 ssl"      -p 8000:8000      -p 8443:8443     -p 127.0.0.1:8001:8001     -p 127.0.0.1:8444:8444      kong:latest



&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Verify its running.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

curl -i http://localhost:8001/


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;This should return 200 OK response. That means Kong is up and running and ready for configuration.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1613442337409%2Fygp8gz9OY.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1613442337409%2Fygp8gz9OY.png" alt="image.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 4 - Expose services through Kong Gateway
&lt;/h2&gt;

&lt;p&gt;Lets start by adding "services" for our APIs.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Service and Route objects let you expose your services to clients with Kong Gateway. When configuring access to your API, you’ll start by specifying a Service. In Kong Gateway, a Service is an entity representing an external upstream API or microservice — for example, a data transformation microservice, a billing API, and so on.&lt;/p&gt;

&lt;p&gt;The main attribute of a Service is its URL, where the service listens for requests. You can specify the URL with a single string, or by specifying its protocol, host, port, and path individually.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Lets add service for our API "DC".&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

curl -i -X POST http://localhost:8001/services --data name=DC --data url="http://DC:7001/"



&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;This should give "201 created" response.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1613443010698%2FUkd5nv-CX.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1613443010698%2FUkd5nv-CX.png" alt="image.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Before you can start making requests against the Service, you will need to add a Route to it. Routes determine how (and if) requests are sent to their Services after they reach Kong Gateway. A single Service can have many Routes.&lt;/p&gt;

&lt;p&gt;Lets add 2 routes our service, one will be for our browser based web app (DC-Web) and other for our mobile app (DC-App)&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

curl -i -X POST http://localhost:8001/services/DC/routes   --data "paths[]=/DC-Web"   --data name=DC-Web


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1613443314189%2FqLEAR6NH1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1613443314189%2FqLEAR6NH1.png" alt="image.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;and ..&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

curl -i -X POST http://localhost:8001/services/DC/routes   --data "paths[]=/DC-App"   --data name=DC-App


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1613443390647%2F4j96kyVEy.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1613443390647%2F4j96kyVEy.png" alt="image.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now that we have routes, we can access our APIs using these routes on &lt;strong&gt;PORT 8000&lt;/strong&gt;,&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1613443568414%2FR0Or09lMt.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1613443568414%2FR0Or09lMt.png" alt="image.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;and&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1613443603677%2FlIdytqENG.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1613443603677%2FlIdytqENG.png" alt="image.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;On the similar lines, we can create a service for our "Marvel" service &lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

curl -i -X POST http://localhost:8001/services --data name=Marvel --data url="http://Marvel:7002/"



&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;and add routes for web and App.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

curl -i -X POST http://localhost:8001/services/Marvel/routes   --data "paths[]=/Marvel-Web"   --data name=Marvel-Web


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

curl -i -X POST http://localhost:8001/services/Marvel/routes   --data "paths[]=/Marvel-App"   --data name=Marvel-App


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Now we can control and manage traffic coming from different routes individually.&lt;/p&gt;

&lt;p&gt;In the next part, we will look at few plugins for Kong.&lt;/p&gt;

&lt;p&gt;Thanks for reading. Please do share your inputs.&lt;/p&gt;

</description>
      <category>dotnet</category>
      <category>docker</category>
      <category>microservices</category>
      <category>apigateway</category>
    </item>
    <item>
      <title>Simplest way to use strongly typed configuration in dotnet core</title>
      <dc:creator>Rohit Ramname</dc:creator>
      <pubDate>Fri, 15 Jan 2021 21:06:22 +0000</pubDate>
      <link>https://dev.to/rramname/simplest-way-to-use-strongly-typed-configuration-in-dotnet-core-45go</link>
      <guid>https://dev.to/rramname/simplest-way-to-use-strongly-typed-configuration-in-dotnet-core-45go</guid>
      <description>&lt;p&gt;Hello Friends,&lt;/p&gt;

&lt;p&gt;Every project  has some kind of configuration file, in the format of XML, json etc. Dotnet core projects use Json based config file in which we can store project level settings in Json format. There are mutliple ways to access these values across the project as shown in this  &lt;a href="https://docs.microsoft.com/en-us/aspnet/core/fundamentals/configuration/?view=aspnetcore-5.0" rel="noopener noreferrer"&gt;official documentation&lt;/a&gt; .&lt;/p&gt;

&lt;p&gt;My favorite one is Strongly Typed because ..&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Its less prone to string comparison errors.&lt;/li&gt;
&lt;li&gt;Provides intellisense for easier access.&lt;/li&gt;
&lt;li&gt;and of-course, type safe.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Below is the easiest way I know to use strongly typed approach in asp.net core application.&lt;/p&gt;

&lt;p&gt;Lets start by creating a basic asp.net API application.&lt;br&gt;
Detailed steps can be found  &lt;a href="https://docs.microsoft.com/en-us/aspnet/core/tutorials/first-web-api?view=aspnetcore-5.0&amp;amp;tabs=visual-studio" rel="noopener noreferrer"&gt;here&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;This should put &lt;code&gt;appsettings.json&lt;/code&gt; file in the root project.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;ASP.Net core's configuration can automatically detect the presence of &lt;code&gt;appsettings.json&lt;/code&gt; file if its with this name&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;I have added custom section "&lt;strong&gt;AppDetails&lt;/strong&gt;" in my appsettings.json file.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

{
  "Logging": {
    "LogLevel": {
      "Default": "Information",
      "Microsoft": "Warning",
      "Microsoft.Hosting.Lifetime": "Information"
    }
  },
  "AppDetails": {
    "AppName": "MyCoolApp",
    "AppVersion": "V1"
  },
  "AllowedHosts": "*"
}


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Now create a class called &lt;code&gt;AppDetails.cs&lt;/code&gt; to hold the values from this section.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

  public class AppDetails
    {
        public string AppName { get; set; }
        public string AppVersion { get; set; }
    }


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;blockquote&gt;
&lt;p&gt;In the class file, make sure the field names match with those in the appsettings.json file.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Now open &lt;code&gt;Startup.cs&lt;/code&gt; class and add below line &lt;code&gt;ConfigureServices&lt;/code&gt; method&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

services.Configure&amp;lt;AppDetails&amp;gt;(Configuration.GetSection("AppDetails"));


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;In this code, we configuring AppDetails class to hold data from Appdetails section from the config file.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Again, point to note here is, ASP.Net core's configuration service can automatically detect the presence of &lt;code&gt;appsettings.json&lt;/code&gt; file if its with this name. Hence it knows where to look for the section with the name "&lt;strong&gt;AppDetails&lt;/strong&gt;".&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;And that's basically it. Now we can access these settings anywhere in our application using Dependency Injection&lt;/p&gt;

&lt;p&gt;Now , in your controller, create a property for AppDetails class , inject  &lt;code&gt;IOptions&amp;lt;AppDetails&amp;gt;&lt;/code&gt; as a dependency and assign it to the instance.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

    [ApiController]
    [Route("[controller]")]
    public class CoolController:Controller
    {
        AppDetails configs { get; set; }
        public CoolController( IOptions&amp;lt;AppDetails&amp;gt; Configuration )
        {
            configs = Configuration.Value;
        }
        public string GetVersion( )
        {
            return configs.AppName + ":" + configs.AppVersion;
        }
    }


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;If you run the application and launch &lt;code&gt;https://localhost:44350/cool&lt;/code&gt;, you should see it return the values from our appsettings.json file.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1610744054536%2Fz60mvAID9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1610744054536%2Fz60mvAID9.png" alt="image.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Please do share if you find it helpful or otherwise.&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>dotnet</category>
    </item>
    <item>
      <title>Run Angular and dotnet core api app in docker container with docker compose — Part 4 — Docker Compose and The Conclusion</title>
      <dc:creator>Rohit Ramname</dc:creator>
      <pubDate>Tue, 12 Jan 2021 03:45:33 +0000</pubDate>
      <link>https://dev.to/rramname/run-angular-and-dotnet-core-api-app-in-docker-container-with-docker-compose-part-4-docker-compose-and-the-conclusion-4fa</link>
      <guid>https://dev.to/rramname/run-angular-and-dotnet-core-api-app-in-docker-container-with-docker-compose-part-4-docker-compose-and-the-conclusion-4fa</guid>
      <description>&lt;p&gt;Hello Friends,&lt;/p&gt;

&lt;p&gt;In this last part of the series, we will be looking at creating docker compose file which will hold 2 applications that we created in last 2 parts (KnowThatCountryAPI and KnowThatCountryUI) together and run it as a single command with their respective docker files in one container.&lt;/p&gt;

&lt;p&gt;Lets create that docker-compose.yaml file at root as below.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

version: '3.7'
services: 
    apiservice:
        container_name: ktcapi
        build: 
            context: ./KnowThatCountryAPI
            dockerfile: dockerfile
        ports: 
          - "5005:5005"
    uiservice:
        container_name: ktcui
        build: 
            context: ./KnowThatCountryUI
            dockerfile: dockerfile.UI
        ports: 
          - "5006:80"
        depends_on: 
          - apiservice



&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Lets dive in.&lt;/p&gt;

&lt;p&gt;Each application container is treated as a service so that they can talk to each other.&lt;br&gt;
Here we are creating 2 services, apiservice for KnowThatCountryAPI and uiservice as KnowThatCountryUI application.&lt;/p&gt;

&lt;p&gt;For each service, we give build instructions.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Here, we are going to use the same dockerfiles that we used to build individual applications so that we can keep this tidy and also if we have to build/test the applications separately, then we don't have to standup the whole thing. We achieve that using context in docker.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Lets check the API service creation part.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

apiservice:
        container_name: ktcapi
        build: 
            context: ./KnowThatCountryAPI
            dockerfile: dockerfile
        ports: 
          - "5005:5005"


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Here, we are naming the container as ktcapi, like we did in part 2 of this series.&lt;br&gt;
We will be using the same docker file that we created for the API project, hence we set the context of this service by giving the location of the docker file which is ./KnowThatCountryAPI. Now this container image will be created with ./KnowThatCountryAPI as the root.&lt;/p&gt;

&lt;p&gt;Then we assign local port 5005 to 5005 inside the container.&lt;/p&gt;

&lt;p&gt;Now lets move on to the UI service creation part.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

    uiservice:
        container_name: ktcui
        build: 
            context: ./KnowThatCountryUI
            dockerfile: dockerfile.UI
        volumes: 
            - ./src:/app2/src
        ports: 
          - "5006:80"


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Here, we are naming the container as ktcui, like we did in part 3 of this series. We are setting the context as ./KnowThatCountryUI since our docker file is located there and we can use all of those paths already defined in the docker file.&lt;br&gt;
And assign port 5006 on local to port 80 inside the container.&lt;/p&gt;

&lt;p&gt;.... and we are done.&lt;/p&gt;

&lt;p&gt;Now we ready to launch the application. First we build the whole thing with&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

docker-compose build


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;With this command, docker builds both of these services as per the instructions specified in their respective docker files.&lt;/p&gt;

&lt;p&gt;Once the services are built, all we have to do is &lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

docker-compose up


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;This will spin up the containers created in previous command and make them ready to use.&lt;/p&gt;

&lt;p&gt;Now if you visit &lt;a href="http://localhost:5006" rel="noopener noreferrer"&gt;http://localhost:5006&lt;/a&gt;, you should be able to see the application running in docker container.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1610420502526%2Fe09ozc4rG.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1610420502526%2Fe09ozc4rG.png" alt="image.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Hope this was helpful in getting started with angular, .Net core and Docker.&lt;/p&gt;

&lt;p&gt;Your feedbacks are always appreciated !!&lt;/p&gt;

</description>
      <category>docker</category>
      <category>dotnet</category>
      <category>angular</category>
      <category>dotnetcore</category>
    </item>
    <item>
      <title>Run Angular and dotnet core api app in docker container with docker compose — Part 3 — The Angular UI and docker</title>
      <dc:creator>Rohit Ramname</dc:creator>
      <pubDate>Tue, 12 Jan 2021 03:45:20 +0000</pubDate>
      <link>https://dev.to/rramname/run-angular-and-dotnet-core-api-app-in-docker-container-with-docker-compose-part-3-the-angular-ui-and-docker-7in</link>
      <guid>https://dev.to/rramname/run-angular-and-dotnet-core-api-app-in-docker-container-with-docker-compose-part-3-the-angular-ui-and-docker-7in</guid>
      <description>&lt;p&gt;Hello Friends,&lt;/p&gt;

&lt;p&gt;In this part we will be building our Angular UI to show the countries returned by the dotnet core API. I am going to call it as KnowThatCountryUI (ktcui)&lt;/p&gt;

&lt;p&gt;This is a very basic Angular application with the folder structure as below&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--1vZr6_n8--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1610388618967/d4ysy3j6x.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--1vZr6_n8--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1610388618967/d4ysy3j6x.png" alt="image.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We have one injectable service file which call the API and fetches the data. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--yGDai-2H--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1610389547320/XUjZRsoqK.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--yGDai-2H--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1610389547320/XUjZRsoqK.png" alt="image.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;This service is talking to the API service that we created in part 2 of this series which is running at port 5005 on local machine.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;in the app.component.ts file, we inject that service as a dependancy and subscribe to the observable.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--4wRS86Gv--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1610388727640/7cAo0yG0A.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--4wRS86Gv--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1610388727640/7cAo0yG0A.png" alt="image.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;and in the app.component.html, we loop over the results and display them&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--UtUyldSd--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1610388764073/YKKH2lM89.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--UtUyldSd--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1610388764073/YKKH2lM89.png" alt="image.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;OK now our basic UI app is ready to talk to the service and show data.&lt;/p&gt;

&lt;p&gt;Now, lets run it in a docker container by creating dockerfile.&lt;/p&gt;

&lt;p&gt;Below is my docker file for UI. (dockerfile.ui)&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;FROM node:10.15.3-slim as build
WORKDIR /KTCUI
COPY src ./src
COPY *.json ./
RUN npm install -g @angular/cli@7.3.10
RUN npm install
RUN ng build --prod

FROM nginx:alpine as deploy
WORKDIR /KTCUI
COPY --from=build /KTCUI/dist/KnowThatCountryUI/*.* /usr/share/nginx/html/

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here we are using node:10.15.3-slim as the base image and installing all the angular dependencies from package.json file inside the container.&lt;/p&gt;

&lt;p&gt;Notice the last 3 lines.&lt;br&gt;
To run the angular application, we are using nginx:alpine image as web server.&lt;/p&gt;

&lt;p&gt;Now, we can build the image for our UI Application.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;docker build -t ktcui -f dockerfile.ui .
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;and then run it by assigning a port.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;docker run -it -p 5006:80 --name ktcui ktcui
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In above command, we are assigning port 5006 on local machine with port 80 inside the container which is the default port for nginx.&lt;/p&gt;

&lt;p&gt;Now, if we visit &lt;a href="http://localhost:5006"&gt;http://localhost:5006&lt;/a&gt;, we should be able to see our UI.&lt;/p&gt;

&lt;p&gt;Thanks for reading.&lt;/p&gt;

&lt;p&gt;In the next and the last part of this series, we will see how to pull this all together in one file and one command and stand up the applications together and get them working.&lt;/p&gt;

</description>
      <category>docker</category>
      <category>dotnet</category>
      <category>angular</category>
      <category>dotnetcore</category>
    </item>
    <item>
      <title>Run Angular and dotnet core api app in docker container with docker compose — Part 2 — The dotnet core API service and docker</title>
      <dc:creator>Rohit Ramname</dc:creator>
      <pubDate>Tue, 12 Jan 2021 03:44:59 +0000</pubDate>
      <link>https://dev.to/rramname/run-angular-and-dotnet-core-api-app-in-docker-container-with-docker-compose-part-2-the-dotnet-core-api-service-and-docker-pa1</link>
      <guid>https://dev.to/rramname/run-angular-and-dotnet-core-api-app-in-docker-container-with-docker-compose-part-2-the-dotnet-core-api-service-and-docker-pa1</guid>
      <description>&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  “F5” + “NG Serve” to docker compose up — Part 2 — The dotnet core API service and docker
&lt;/h1&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmiro.medium.com%2Fmax%2F14720%2F0%2AFdzZEFC7w989WAls" class="article-body-image-wrapper"&gt;&lt;img alt="Image for post" src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmiro.medium.com%2Fmax%2F14720%2F0%2AFdzZEFC7w989WAls"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Photo by &lt;a href="https://unsplash.com/@lefterisk?utm_source=medium&amp;amp;utm_medium=referral" rel="noopener noreferrer"&gt;Lefteris kallergis&lt;/a&gt; on &lt;a href="https://unsplash.com?utm_source=medium&amp;amp;utm_medium=referral" rel="noopener noreferrer"&gt;Unsplash&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Hello Friends,&lt;/p&gt;

&lt;p&gt;In this part we will be building our first application, the dotnet core API that serves information about countries. I am going to call it as KnowThatCountryAPI (ktcapi)&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;For the data, I am going to third party API provider. Please check it out.&lt;br&gt;
&lt;a href="https://restcountries.eu/" rel="noopener noreferrer"&gt;https://restcountries.eu/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;For this artical, I am not going to call the API in code. Instead, I have already downloaded all the information in json file and will be using that as a data source. You can check the full code on &lt;a href="https://github.com/rramname/KTCDocker/tree/master/KnowThatCountryAPI" rel="noopener noreferrer"&gt;GitHub&lt;/a&gt;.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The objective of this series to understand the docker files hence, I wont go into details of each file in the API project, but this is how my CountriesController.cs looks like.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;[ApiController]
    [Route("[controller]/[action]")]
    public class CountriesController : Controller
    {
        ICountryServices countryService;
        public CountriesController(ICountryServices country )
        {
            countryService = country;
        }
        [HttpGet]
        public List&amp;lt;CountryInfo&amp;gt; GetAll()
        {
            return countryService.GetAll();
        }

[HttpGet]
        public CountryInfo GetByID(int id )
        {
            return countryService.GetByID(id);
        }
}&amp;lt;/span&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If we go to the root directory and run the app as&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;dotnet run&amp;lt;/span&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;we should be able to hit the API and get results.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;[https://localhost:5001/Countries/GetAll](https://localhost:5001/Countries/GetAll)&amp;lt;/span&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;Notice that I am using port 5001 for api project in launchsettings.json but you can any port you prefer.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmiro.medium.com%2Fmax%2F60%2F1%2AnvFMmxmoDGABck1QexK7nQ.png%3Fq%3D20" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmiro.medium.com%2Fmax%2F60%2F1%2AnvFMmxmoDGABck1QexK7nQ.png%3Fq%3D20" alt="Image for post"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmiro.medium.com%2Fmax%2F3182%2F1%2AnvFMmxmoDGABck1QexK7nQ.png" class="article-body-image-wrapper"&gt;&lt;img alt="Image for post" src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmiro.medium.com%2Fmax%2F3182%2F1%2AnvFMmxmoDGABck1QexK7nQ.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Great. Now that &lt;span id="rmm"&gt;w&lt;/span&gt;e have our API project ready, we need to run it into a docker container.&lt;/p&gt;

&lt;p&gt;We do that by creating a dockerfile at the root.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;FROM mcr.microsoft.com/dotnet/core/sdk:3.1 AS build-env

WORKDIR /app

COPY ./KnowThatCountryAPI/ ./
RUN dotnet restore KnowThatCountryAPI.csproj

COPY . ./
RUN dotnet publish -c Release -o out

FROM mcr.microsoft.com/dotnet/core/aspnet:3.1
WORKDIR /app
COPY --from=build-env /app/out .
ENV ASPNETCORE_URLS=http://+:5005  
ENTRYPOINT ["dotnet", "KnowThatCountryAPI.dll"]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is very basic docker file for running dotnet core apps and you can find the details on numerous blogs including the official documentation. But we want to specifically highlight below part.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ENV ASPNETCORE_URLS=http://+:5005  

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This part sets the environment variable ASPNETCORE_URLS for the docker container. .net core uses this URL and port to run the application. Based on this, our application will run at port &lt;strong&gt;5005 inside the docker container.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Now , we create an image from the docker file at current location (hence the dot in the end) by tagging it as ktcapi&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;docker build -t ktcapi .
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;and run ktcapi image by exposing port 5005 and tag it as ktcapi.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;docker run --rm -p 5005:5005 --name=ktcapi ktcapi
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmiro.medium.com%2Fmax%2F60%2F1%2AlnWAafyXWC3zynv40VzIWw.png%3Fq%3D20" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmiro.medium.com%2Fmax%2F60%2F1%2AlnWAafyXWC3zynv40VzIWw.png%3Fq%3D20" alt="Image for post"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmiro.medium.com%2Fmax%2F1398%2F1%2AlnWAafyXWC3zynv40VzIWw.png" class="article-body-image-wrapper"&gt;&lt;img alt="Image for post" src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmiro.medium.com%2Fmax%2F1398%2F1%2AlnWAafyXWC3zynv40VzIWw.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;At this point, we should be able to access the API at port 5005 inside the container.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmiro.medium.com%2Fmax%2F60%2F1%2AnvFMmxmoDGABck1QexK7nQ.png%3Fq%3D20" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmiro.medium.com%2Fmax%2F60%2F1%2AnvFMmxmoDGABck1QexK7nQ.png%3Fq%3D20" alt="Image for post"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmiro.medium.com%2Fmax%2F3182%2F1%2AnvFMmxmoDGABck1QexK7nQ.png" class="article-body-image-wrapper"&gt;&lt;img alt="Image for post" src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmiro.medium.com%2Fmax%2F3182%2F1%2AnvFMmxmoDGABck1QexK7nQ.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Great. We have working container for our API.&lt;/p&gt;

&lt;p&gt;In the next part, we will look at our UI application in Angular that will be using this API to display the data.&lt;/p&gt;

&lt;p&gt;Thanks for reading…see you in part 3 of this series.&lt;/p&gt;

</description>
      <category>docker</category>
      <category>dotnet</category>
      <category>angular</category>
      <category>dotnetcore</category>
    </item>
    <item>
      <title>Run Angular and dotnet core api app in docker container with docker compose — Part 1 — The Plan</title>
      <dc:creator>Rohit Ramname</dc:creator>
      <pubDate>Tue, 12 Jan 2021 03:44:47 +0000</pubDate>
      <link>https://dev.to/rramname/run-angular-and-dotnet-core-api-app-in-docker-container-with-docker-compose-part-1-the-plan-m21</link>
      <guid>https://dev.to/rramname/run-angular-and-dotnet-core-api-app-in-docker-container-with-docker-compose-part-1-the-plan-m21</guid>
      <description>&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  “F5” + “NG Serve” to docker compose up — Part 1 — The Plan
&lt;/h1&gt;

&lt;p&gt;Hello Friends,&lt;/p&gt;

&lt;p&gt;In this short beginner friendly series, I will be documenting a path to run .core api project and angular 7 app in a docker container instead of running and deploying as 2 separate apps. The objective of this series is not the code but is to get familiarize with docker and how we can build a container with 2 application that talk to each other.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Use case:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Create an API application in .Net Core that provides API to access basic information about countries.&lt;/p&gt;

&lt;p&gt;Create an UI appl&lt;span id="rmm"&gt;i&lt;/span&gt;cation in Angular that uses countries API to get the data and display it on the UI.&lt;/p&gt;

&lt;p&gt;Here in this scenario, there are few challenges.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Build server should have .Net SDK 3 which is used to develop the API project.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Build server should have specific version of Node and Angular CLI that is used to develop the project&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;We will have to setup 2 applications in multiple environment in the SDLC process and configure them correctly. (Port, protocols etc)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;All developers should have these specific framework versions installed on their machine to be able to contribute.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;All of this turn into another requirement; THE Document (which nobody will end up reading). This document will need have different sections for Developer setup and server setup.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This looks like a great use case for Docker. In this process, we will be creating a docker file for each of these apps. This will help us to work on these apps individually. In the end, will create one docker compose file that will tie both of them together in case where we need to run it as ONE application.&lt;/p&gt;

&lt;p&gt;In short, this will be the end result.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmiro.medium.com%2Fmax%2F60%2F1%2ASOhH67vwrbf1dxyZc-Xabw.png%3Fq%3D20" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmiro.medium.com%2Fmax%2F60%2F1%2ASOhH67vwrbf1dxyZc-Xabw.png%3Fq%3D20" alt="Image for post"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmiro.medium.com%2Fmax%2F2638%2F1%2ASOhH67vwrbf1dxyZc-Xabw.png" class="article-body-image-wrapper"&gt;&lt;img alt="Image for post" src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmiro.medium.com%2Fmax%2F2638%2F1%2ASOhH67vwrbf1dxyZc-Xabw.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;and the folder structure will be as below.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmiro.medium.com%2Fmax%2F60%2F1%2ApTxCZC86K6HWoG1F67T5bw.png%3Fq%3D20" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmiro.medium.com%2Fmax%2F60%2F1%2ApTxCZC86K6HWoG1F67T5bw.png%3Fq%3D20" alt="Image for post"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmiro.medium.com%2Fmax%2F666%2F1%2ApTxCZC86K6HWoG1F67T5bw.png" class="article-body-image-wrapper"&gt;&lt;img alt="Image for post" src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmiro.medium.com%2Fmax%2F666%2F1%2ApTxCZC86K6HWoG1F67T5bw.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As you can see here, we will have 2 applications, KnowThatCountryAPI which will be our dotnet core API project and KnowThatCountryUI, which will be our UI project which will get data from the API project. In the end, we have docker-compose.yaml file to tie them up together.&lt;/p&gt;

&lt;p&gt;That’s the introduction. Thank you for reading. Will see you in part 2:&lt;br&gt;
“F5” + “NG Serve” to docker compose up — Part 2 — The dotnet core API service and docker&lt;/p&gt;

</description>
      <category>docker</category>
      <category>dotnet</category>
      <category>angular</category>
      <category>dotnetcore</category>
    </item>
    <item>
      <title>Use of official images for blogs </title>
      <dc:creator>Rohit Ramname</dc:creator>
      <pubDate>Sun, 25 Oct 2020 19:12:31 +0000</pubDate>
      <link>https://dev.to/rramname/use-of-official-images-for-blogs-46a4</link>
      <guid>https://dev.to/rramname/use-of-official-images-for-blogs-46a4</guid>
      <description>&lt;p&gt;Does anybody know if we are allowed to use official images of dotnet, docker, angular for our blogs? Just wondering about copyright etc.&lt;/p&gt;

</description>
      <category>discuss</category>
      <category>dotnet</category>
      <category>docker</category>
      <category>angular</category>
    </item>
    <item>
      <title>7 Useful YouTube cannels I follow for software technologies and probably you should too....</title>
      <dc:creator>Rohit Ramname</dc:creator>
      <pubDate>Thu, 15 Oct 2020 18:22:59 +0000</pubDate>
      <link>https://dev.to/rramname/7-useful-youtube-cannels-i-follow-for-development-technologies-55nb</link>
      <guid>https://dev.to/rramname/7-useful-youtube-cannels-i-follow-for-development-technologies-55nb</guid>
      <description>&lt;p&gt;Remember the time when we (most of us) used to commute to work? It was just about 8 months ago but feels like a dream because of the pandemic. &lt;/p&gt;

&lt;p&gt;I used to have a train ride for about 50 min one way , so I decided to make use of that time to learn. To keep myself from dozing off, I started searching for YouTube channels that I can watch during that ride.  This blog post is to share what I have in my subscribed channels list.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;I am a full stack .Net and angular developer. Hence most of my &amp;gt;list is related to those technologies but few of them are very generic and just about current trends in software&lt;/em&gt;. &lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;1.&lt;a href="https://www.youtube.com/c/NDCConferences/videos" rel="noopener noreferrer"&gt;&lt;strong&gt;NDC Conferences&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fj3llb31nrloj8ca73ik1.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fj3llb31nrloj8ca73ik1.PNG" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After launching in Oslo 2008, NDC quickly became one of Europe’s largest conferences for .NET &amp;amp; Agile development. Since then, the conference has evolved to encompass all technologies relevant to Software Developers. NDC speakers come from all over the world and are recognized as experts and thought leaders in their field.&lt;/p&gt;

&lt;p&gt;2.&lt;a href="https://www.youtube.com/c/GotoConferences/videos" rel="noopener noreferrer"&gt;&lt;strong&gt;GOTO Conferences&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F219ahbbe9x6n0jp5u91k.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F219ahbbe9x6n0jp5u91k.PNG" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Created for developers, by developers, GOTO Conferences is a series of software development conferences focused on gathering the best minds in the software community to bring the most interesting topics to light. This channel features video interviews and presentations from GOTO Conferences and GOTO Nights.&lt;/p&gt;

&lt;p&gt;3.&lt;a href="https://www.youtube.com/c/Freecodecamp/videos" rel="noopener noreferrer"&gt;&lt;strong&gt;Free Code Camp&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Website: &lt;a href="https://www.freecodecamp.org/learn" rel="noopener noreferrer"&gt;https://www.freecodecamp.org/learn&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Frtoxlr0nzfn9prc2qg24.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Frtoxlr0nzfn9prc2qg24.PNG" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Free Code Camp is a donor supported non profit organization aimed at helping people learn to code for free. It has thousands of videos, articles, and interactive coding lessons - all freely available to the public.&lt;/p&gt;

&lt;p&gt;4.&lt;a href="https://www.youtube.com/c/shanselman/videos" rel="noopener noreferrer"&gt;&lt;strong&gt;Scott Hanselman&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fghxdbwjcqhppchbay78p.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fghxdbwjcqhppchbay78p.PNG" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;He is a great speaker and a teacher. Scott has been speaking at conferences all over the world for many years. He has video's from plain windows tricks to C# and Kubernetes. &lt;/p&gt;

&lt;p&gt;5.&lt;a href="https://www.youtube.com/c/dotNET/videos" rel="noopener noreferrer"&gt;&lt;strong&gt;dotNET&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fajttnksrxz1o7ni9n2sx.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fajttnksrxz1o7ni9n2sx.PNG" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This is the official YouTube channel for the .NET team at Microsoft. A great resource to know about latest and greatest in .Net.&lt;/p&gt;

&lt;p&gt;6.&lt;a href="https://www.youtube.com/c/visualstudio/videos" rel="noopener noreferrer"&gt;&lt;strong&gt;Microsoft Visual Studio&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F2xqm3203mjvdw2t2ynky.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F2xqm3203mjvdw2t2ynky.jpg" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This is the official channel from Microsoft for events and videos related to Visual Studio, the amazing tools and services for you to create awesome software for yourself...or millions of people. Follow this for conference videos related to Visual Studio, VS Code, Microsoft Build etc.&lt;/p&gt;

&lt;p&gt;7.&lt;a href="https://www.youtube.com/c/MicrosoftAzure/videos" rel="noopener noreferrer"&gt;&lt;strong&gt;Microsoft Azure&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fmpxvfinbesa0zl018q5c.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fmpxvfinbesa0zl018q5c.PNG" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Here you'll find the latest products &amp;amp; solutions news, demos, and in-depth technical insights as well as training videos for Microsoft Azure. A must have for Azure users.&lt;/p&gt;

&lt;p&gt;Hope this list will be helpful for your "journey". Please suggest if you know of any other channels that are worth a subscribe.&lt;/p&gt;

&lt;p&gt;Thank you for reading.&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>dotnet</category>
      <category>productivity</category>
      <category>programming</category>
    </item>
    <item>
      <title>How to setup an email alert for high Active Message count for Azure Service Bus Queue</title>
      <dc:creator>Rohit Ramname</dc:creator>
      <pubDate>Tue, 13 Oct 2020 02:12:09 +0000</pubDate>
      <link>https://dev.to/rramname/how-to-setup-an-email-alert-for-high-active-message-count-for-azure-service-bus-queue-13f0</link>
      <guid>https://dev.to/rramname/how-to-setup-an-email-alert-for-high-active-message-count-for-azure-service-bus-queue-13f0</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;This post assumes that you have an Azure service bus namespace &amp;gt;setup with a Queue. Here is the official documentation for &amp;gt;instructions.&lt;/p&gt;

&lt;p&gt;I am going to use a service bus namespace AlertDemoServiceBus which &amp;gt;has a queue named Orders.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Lets start!&lt;/p&gt;

&lt;p&gt;Login to you account and navigate to the service bus namespace.&lt;/p&gt;

&lt;p&gt;Click on Alerts and New Alert Rule&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--XCfnEtMh--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/p2avmjtsv0iowjkezs9v.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--XCfnEtMh--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/p2avmjtsv0iowjkezs9v.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This should open a new alert rule page. Here, we select the resource, which is our service bus namespace. &lt;/p&gt;

&lt;p&gt;If have only 1 service queue, then it should auto-populate.&lt;br&gt;
Now, we have to set the condition for alert rule.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--aI6XJlde--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/5yak5kkoor8buvutd33p.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--aI6XJlde--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/5yak5kkoor8buvutd33p.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;On click of select condition link, we get a new window in which we can setup the logic. &lt;/p&gt;

&lt;p&gt;We can setup alert on various signals as shown below but here we will using “Count of active messages in a Queue/Topics”&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--4QVSzSvS--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/uic3c6umv5la2676uyep.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--4QVSzSvS--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/uic3c6umv5la2676uyep.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Once we select the base signal, on the next page we can configure the logic as below.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--l0urDlbQ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/8xcbrnj9zz0sir3vp1rb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--l0urDlbQ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/8xcbrnj9zz0sir3vp1rb.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Here I am setting alert on Orders Entity with threshold as 1000 active message and the condition will be checked every 5 mins.&lt;/p&gt;

&lt;p&gt;Next would be the part where we setup actual Alert email when the condition is met. We have to create an Alert Group to achieve that. &lt;/p&gt;

&lt;p&gt;This takes us through a wizard.&lt;br&gt;
First step would be to name it. I am creating an alert with a name HighCntAlert&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--cp2E6S2K--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/zntyoz1g524fo2ikpkrl.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--cp2E6S2K--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/zntyoz1g524fo2ikpkrl.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The next part would be setup notification.&lt;br&gt;
Lets give it a name.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--5zUbU9qx--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/m6d5w7azd6kx0se7gjj4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--5zUbU9qx--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/m6d5w7azd6kx0se7gjj4.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;And provide an email address to receive an alert&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--13jRnWO_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/nhz73flp2y56dm269b94.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--13jRnWO_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/nhz73flp2y56dm269b94.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;As we can notice here, we can also request for an SMS or voice message but it attracts extra charges.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Once its setup, we can click review and create. It should create an alert group with email as a notification option for us.&lt;br&gt;
Give it a name and severity Level and enable it upon creation to start receiving alerts immediately .&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--0L5X_Skz--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/0nftncm3wt5owkevy4g0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--0L5X_Skz--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/0nftncm3wt5owkevy4g0.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This should trigger a confirmation email.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--DsMRXspq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/byfr2pynsq12z67mhl8h.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--DsMRXspq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/byfr2pynsq12z67mhl8h.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Once its ready, we should be able to see it under “Manage Alert Rules” menu.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--6pAg6Zox--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/v30ms7ak80cwcv73db52.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--6pAg6Zox--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/v30ms7ak80cwcv73db52.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We are all setup!!&lt;br&gt;
Now, when the queue count goes to 1000 as per our condition, Azure will create an alert. We can see this alert by navigating to “Alert” menu on the namespace.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;We have to wait for 5 mins for azure to trigger the condition as &amp;gt;we had configured in our rule above&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;After 5 mins, we can see an alert for Sev 2 raised for our queue in Alerts section of our service bus namespace.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--jahZy4AK--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/n2s1sv56p0q1z4bofxbe.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--jahZy4AK--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/n2s1sv56p0q1z4bofxbe.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;And an email sent to our registered email address from &lt;a href="mailto:azure-noreply@microsoft.com"&gt;azure-noreply@microsoft.com&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--c0qbU7If--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/fwm7dyhdqmr8xtau0v6i.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--c0qbU7If--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/fwm7dyhdqmr8xtau0v6i.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In the details, notice the alert state.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--9wywRbEv--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/l6np0ybois2336s3seof.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--9wywRbEv--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/l6np0ybois2336s3seof.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Once the queue count goes down, the state automatically changes to Resolved&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--5LVep9uh--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/1hxyyfvijiyo1z9g5xqz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--5LVep9uh--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/1hxyyfvijiyo1z9g5xqz.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;and we also get an email notification about this progress.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Jy0K5VoB--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/o8wbak0x8xyxwcojifjt.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Jy0K5VoB--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/o8wbak0x8xyxwcojifjt.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Hope this was helpful. I gladly appreciate your comments and feedback.&lt;/p&gt;

&lt;p&gt;THANK YOU!!&lt;/p&gt;

</description>
      <category>azure</category>
      <category>serverless</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Call a SQL function in EF Core 3 without Linq queries, mapping and translation</title>
      <dc:creator>Rohit Ramname</dc:creator>
      <pubDate>Thu, 01 Oct 2020 02:17:35 +0000</pubDate>
      <link>https://dev.to/rramname/ef-core-3-without-linq-queries-mapping-and-translation-o7m</link>
      <guid>https://dev.to/rramname/ef-core-3-without-linq-queries-mapping-and-translation-o7m</guid>
      <description>&lt;p&gt;I have come across couple scenarios where I need to call an already existing scalar function in SQL server that has some logic into my C# EF Core 3 application for reusability. But most the guides out there show how can this be done only by mapping it to a C# function with Throw new Notimplemented exception and using Linq queries like official documentation.&lt;br&gt;
I did not need to use Linq queries so I am doing it in a different way as below.&lt;/p&gt;

&lt;p&gt;Let’s say you have a SQL function.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;CREATE FUNCTION dbo.IsStrogestAvenger(@Superhero varchar(100))
RETURNS bit
AS
BEGIN
    declare @result bit=0
    if(@Superhero ='Thor')
        set @result=1
    else
        set @result=0
RETURN @result
END
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;br&gt;
`&lt;/p&gt;

&lt;p&gt;Now turn to our C# code.&lt;br&gt;
For result, lets create a model to hold this output.&lt;/p&gt;

&lt;p&gt;`&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;public class IsStrongestAvengerResult
{
   public bool IsStrongestAvenger { get; set; }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;br&gt;
`&lt;/p&gt;

&lt;p&gt;Map it in context class as below&lt;/p&gt;

&lt;p&gt;`&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;public virtual DbSet&amp;lt;IsStrongestAvengerResult&amp;gt; IsStrongestAvenger{ get; set; }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;br&gt;
`&lt;/p&gt;

&lt;p&gt;And&lt;/p&gt;

&lt;p&gt;`&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.Entity&amp;lt;IsStrongestAvengerResult&amp;gt;(e =&amp;gt; e.HasNoKey());
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;br&gt;
`&lt;/p&gt;

&lt;p&gt;Now we use FromSqlInterpolated to call this function and map.&lt;/p&gt;

&lt;p&gt;`&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;public bool IsStrongestAvenger(string Superhero)
  {
    return context.IsStrongestAvenger.FromSqlInterpolated($"select   dbo.IsStrogestAvenger ({Superhero}) as IsStrongestAvenger").FirstOrDefault().IsStrongestAvenger;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;br&gt;
`&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;Important thing to note above is the use of AS &amp;gt;IsStrongestAvenger and it should match with the property name in &amp;gt;our model IsStrongestAvengerResult.IsStrongestAvenger&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Now this function can be directly call from C# to get the output.&lt;/p&gt;

&lt;p&gt;Thank you for reading. Comments and Suggestion are highly appreciated.&lt;/p&gt;

</description>
      <category>dotnet</category>
      <category>csharp</category>
      <category>entityframework</category>
    </item>
  </channel>
</rss>
