Posts

Using Angular Material in an angular app with some best practices

Image
Angular Material is a UI component library for angular. Ok let's see how do you use this within an angular application using some of the best practices. Prerequisites 1. Code editor (Ex: VS Code) installed 2. Node.js installed 3. Angular cli installed ( https://cli.angular.io/ ) I think you already know how to create a new angular application with Angular cli. If you can't remember lets create a new angular app. 1. Create an angular app Open the terminal and user command: ng new [name of your app] 2. Install angular material Navigate inside your app with command prompt and run command: ng add @angular/material When it prompts to install: 1. HammerJs for Gesture recognition: Select Yes 2. Setup browser animations: Select Yes 3. Create a module to hold angular material components By creating a dedicate module for this will help to import all the required angular material components that we are going to use in the app within this module. Then we can im...

Deploy Angular 8 app to Azure with Azure DevOps

Image
1. Create a Azure Web App. Use the following Configurations:      Runtime Stack: ASP.NET V4.7      Operating System: Windows You can select your own subscription plan, resource group and region.  2. Create a Git repository to hold the Angular app 2.1. Initialize your angular application 2.2. Commit and Push the code.  3. Create a Pipeline in Azure DevOps.  3.1. Login to the Azure DevOps. ( https://dev.azure.com/ ) 3.2. Create a project:          I'll select Private as visibility and Git as Version control.  NOTE: Azure DevOps provides different features.               For this task we are going to focus on Pipelines.  4. Pipeline Part 1: Integrate Git  From the Connect section select: Use the classic editor. 4.1. Select a Source as GitHub and authenticate with your GitHub account using OAuth.  ...

Publish a .Net Core Web API with Entity Framework Core to Azure (App Service) - Express Guide

Image
Azure - SQL Database ( https://azure.microsoft.com/en-us/pricing/details/sql-database/single/ ) - ~$4.8971/month 1. Create SQL Server database instance Azure provides different options for SQL Databases: Databases offer the following deployment options: As a single database -With its own set of resources managed via a database server. A single database is similar to a contained database in SQL Server. This option is optimized for modern application development of new cloud-born applications. Hyperscale and serverless options are available. An elastic pool -Is a collection of databases with a shared set of resources managed via a database server. Single databases can be moved into and out of an elastic pool. This option is optimized for modern application development of new cloud-born applications using the multi-tenant SaaS application pattern. Elastic pools provide a cost-effective solution for managing the performance of multiple databases that have variable usage patt...

Publish .Net Core Web API to Azure (App Service) - Express Guide

Image
Required Azure Services - App Service ( https://azure.microsoft.com/en-us/pricing/details/app-service/linux/ ) - Have a Free tier Create Azure App Service (Web App) 1. Login to your Azure portal. 2. Search for 'App Services' and select it 3. From the App Services window click on 'Add' - This will redirect you to create Azure Web App page 4. Select your Azure Subscription and Resource group (Create new one if you don't have any) 5. Give instance name, select Publish mode as Code 6. Select your Runtime Stack (.Net or .Net Core version which supports your application). 7.You can select either Windows or Linux as Operating System. I used Linux because I'm hosting a .net Core Web API with Entity Framework Core. NOTE: If your app is .Net standard application you have to select Windows. 8. Select Region as you like. 9. Select App Service Plan. - Create new App Service plan if you like or you can keep the auto generated name. - Select Sku (Stock Keeping ...

Host a Static Web Site with Azure and https - Express Guide

Image
Picture Source:  https://azure.microsoft.com/en-ca/blog/azure-storage-static-web-hosting-public-preview/ Create a static web site 1. Login to Azure portal (If you donat have you can signup for free) 2. Go to storage accounts and cerate a new storage account with your desiered name. 2.1. Make sure to select 'Storage V2' in Account Kind. 3. Go to Static Website under newly created Storage Account. 3.1. Enable it and give index page (index.html) and error page (404.html). 3.2. Save. 3.3. Copy the Primary endpoint to later use. 4. Go to Containers under newly created Storage Account 4.1. Inside that you can see $web container - which holds your websites' files (html, javascript, css) 4.2. Upload a file(s) - I uploaded as index.html which I have set as my index page, so when I use my url; the content of this page will be shown. NOTE: You can download and use Microsoft Azure Storage Explorer to update the files in $web. 5. Open a new tab in your browser and paste...

Entity Framework Core with SQL Server on Mac

Hi All mac and microsoft tech lovers, There was a time where we love to use our macs and microsoft technologies but since there were not quite compatible with each we have to use windows os to work with microsoft technologies. But now microsoft has developed tools and compatibility to do this on any os. So here I would like to show you how to work with SQL Server and Entity Framework Core in your mac. Lets get started... You have to have docker in order to use SQL Server on Mac. So if you are new to this and would like to learn how to do that please read my blog from here and come back to this. Ok.. I think you have set up Docker, SQL Server and Azure Data Studio. I'm going to use Visual Studio for Mac as my IDE. If you like to use that you can download it from: https://visualstudio.microsoft.com/vs/mac/ . Lets continue then.. 1. Open Visual Studio for Mac (VSM) and create a Web API project. I call it MyAPI I'm going to create a project with N-Tier architecture,...

Tool to Synchronize email templates between different SendGrid accounts

Hi All, Here I'll directly provide my code where I developed a tool to copy email templates from one SendGrid account to another SendGrid account. It is nice to have a such tool when migrating all of your newly created and modified email templates from develop environment to production servers. So here is the code that I have came up with: public class EmailSyncService : IEmailSyncService { private readonly EmailSyncSettingsModel _emailSyncSettingsModel; public EmailSyncService(IOptions<EmailSyncSettingsModel> emailSyncSettingsModel) { _emailSyncSettingsModel = emailSyncSettingsModel.Value; } public async Task<List<KeyValuePair<string, string>>> SyncSendGridTemplates(string source, string destination) { var newTemplates = new List<KeyValuePair<string, string>>(); var sourceKey = _emailSyncSettingsModel.GetType().GetProperty(source).GetValue(_emailSyn...