Azure Microservices

Here are the major services other than core services;

Service Fabric

Azure Functions

Small piece of code that we can write. There is a small editor build-in to the browser that we can use.

Azure Logic Apps

Logic apps are pretty much similar to SQL Server integration services or windows workflow where we have some logical steps that executes in parallel or sequential to perform a task.

API Management

Can be used to throttle or secure API. We can put this in front take advantage.

Azure Kubernetes Services

C# tip (Primary Constructor)

View this class;

public class Product
{
   public string Name {get; set;}
   public decimal Price {get; set;}

   public Product(string name, decimal price)
   {
       Name = name;
       Price = price;
   }
}

This can be re-written as;

public class Product(string name, decimal price)
{
   public string Name {get; set;} = name;
   public decimal Price {get; set;} = price;
}

Seems we can save some lines with this new pattern.

jQuery.param()

Create a serialized representation of an array, a plain object, or a jQuery object suitable for use in a URL query string or Ajax request. In case a jQuery object is passed, it should contain input elements with name/value properties.

// <=1.3.2:
$.param({ a: [ 2, 3, 4 ] }); // "a=2&a=3&a=4"
// >=1.4:
$.param({ a: [ 2, 3, 4 ] }); // "a[]=2&a[]=3&a[]=4"
 
// <=1.3.2:
$.param({ a: { b: 1, c: 2 }, d: [ 3, 4, { e: 5 } ] });
// "a=[object+Object]&d=3&d=4&d=[object+Object]"
 
// >=1.4:
$.param({ a: { b: 1, c: 2 }, d: [ 3, 4, { e: 5 } ] });
// "a[b]=1&a[c]=2&d[]=3&d[]=4&d[2][e]=5"

Reference

Read more on jQuery Web site

Using Razor, how do I render a Boolean to a JavaScript variable?

This is our C# model;

public class Foo
{
  public bool IsAllowed {get; set;} = false;
}

We would like to read this property in JS;

let isAllowed = '@Model.IsAllowed' === '@true';
if (isAllowed)
{
    console.log('Allowed reading..');
}
else
{
    console.log('Reading not allowed..');
}

Reference

https://stackoverflow.com/questions/14448604/using-razor-how-do-i-render-a-boolean-to-a-javascript-variable

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean

Uninstall and Reinstall Angular

We are interested in a specific angular version and NOT in a specific angular-cli version (angular-cli is just a tool after all).

Here are the steps (All these steps are done in npm);

If you’re not sure of the angular-cli version installed in your environment, uninstall it.

npm uninstall -g @angular/cli

Then, run (–force flag might be required).

npm cache clean

or, if you’re using npm > 5.

npm cache verify

Install an angular-cli specific version.

npm install -g @angular/cli@wished.version.here

Create a project

ng new you-app-name

The resulting white app will be created in the desired angular version.

I have not found any page displaying the compatibility matrix of angular and angular-cli. So I guess the only way to know what angular-cli version should be installed is to try various versions, create a new project and checkout the package.json to see which angular version is used.

angular versions changelog Here is the changelog from github reposition, where you can check available versions and the differences.

Reference

https://stackoverflow.com/questions/43344600/how-to-install-a-specific-version-of-angular-with-angular-cli