Showing posts with label Azure App Service. Show all posts
Showing posts with label Azure App Service. Show all posts

Monday, August 14, 2023

Azure Application Services

 Azure App Service

Create front-end and back-end web applications.  Development languages supported include:
  • ASP.Net
  • Node.js
  • PHP
  • Python

Azure Static Web App

Create front-end static web application that can connect to back-end APIs and services using client-side scripting.   Supported front-end frameworks include:

  • HTML (no framework)
  • Angular
  • JavaScript
  • jQuery
  • React
  • Vue

Azure Function App

Create API application that can connect to databases, services, and other APIs triggered by an HTTP Request, Message Queue, or Timer.   Development languages supported include:

  • C#
  • Java
  • JavaScript
  • Node.js
  • PowerShell
  • Python
  • TypeScript

Wednesday, December 21, 2022

.Net Dependency Injection

.Net Dependency Injection Service Lifetimes:


Transient

Transient lifetime services are created each time they are requested.

Example:

services.AddTransient<IRequest, MyAppRequest>();


Scoped

For web applications, a Scoped lifetime indicates that services are created once per client connection.

Example:

services.AddScoped<ISettings, ClientSettings>();


Singleton

Singleton lifetime services are created the first time they are requested.  

Accessing application configuration or loading static data are examples of when to use Singleton service.

Example:

services.AddSingleton<ISettings, MyAppSettings>();


Extension Methods:

AddBlobServiceClient

Add Azure Blob Storage

Example:


AddDbContext

A Scoped lifetime service used with Entity Framework Core to connect to a database.

Example:

services.AddDbContext<DataContext>(options => options.UseSqlServer("name=ConnectionStrings:SQLConnectionString"), ServiceLifetime.Scoped);


AddOptions

Extension method for adding configuration related options services to the DI container

Example:


AddQueueServiceClient

Azure Queue Service Client. 

Example:


AddSecretClient

Azure Key Vault Secrets

Example:


AddSqlServer

Registers the given Entity Framework DbContext as a service in the IServiceCollection and configures it to connect to a SQL Server database.

Example:

services.AddSqlServer<DataContext>(hostContext.Configuration["ConnectionStrings:SQLConnectionString"]);