<?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: Rijwan Ansari</title>
    <description>The latest articles on DEV Community by Rijwan Ansari (@rijwanansari).</description>
    <link>https://dev.to/rijwanansari</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%2F908453%2F68653186-e75a-454d-a62e-9fb1c2ee5be6.jpg</url>
      <title>DEV Community: Rijwan Ansari</title>
      <link>https://dev.to/rijwanansari</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/rijwanansari"/>
    <language>en</language>
    <item>
      <title>Dynamic Database API in .NET 9: Clean Architecture &amp; MediatR for Flexible Solutions</title>
      <dc:creator>Rijwan Ansari</dc:creator>
      <pubDate>Tue, 18 Mar 2025 09:01:14 +0000</pubDate>
      <link>https://dev.to/rijwanansari/dynamic-database-api-in-net-9-clean-architecture-mediatr-for-flexible-solutions-53jl</link>
      <guid>https://dev.to/rijwanansari/dynamic-database-api-in-net-9-clean-architecture-mediatr-for-flexible-solutions-53jl</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;Flexibility in database selection is critical in modern application development. A Web API should support multiple database options such as SQL Server, PostgreSQL, MySQL, and SQLite without major code changes. In this article, we will build a .NET 9 Web API using Clean Architecture, Domain-Driven Design (DDD), and MediatR, while implementing dynamic database selection using Entity Framework Core (EF Core).&lt;/p&gt;

&lt;h2&gt;
  
  
  Why Do We Need a Dynamic Database?
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;1. Flexibility in Deployment&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Different environments (development, staging, production) may require different databases.&lt;/li&gt;
&lt;li&gt;Users or clients may have preferences for a specific database technology.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;2. Cost Optimization&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Some databases are more cost-effective depending on usage.&lt;/li&gt;
&lt;li&gt;Cloud providers offer different pricing models for different database engines.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;3. Scalability and Performance&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Some databases are better suited for high-scale applications.&lt;/li&gt;
&lt;li&gt;Ability to switch between relational and NoSQL databases based on use cases.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;4. Vendor Independence&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Avoid vendor lock-in by supporting multiple databases.&lt;/li&gt;
&lt;li&gt;Easier migration between databases if needed.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;5. Multi-Tenant Applications&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Different clients may require different database engines.&lt;/li&gt;
&lt;li&gt;Supports SaaS applications where tenants choose their preferred database.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Key Features
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Clean Architecture for better maintainability&lt;/li&gt;
&lt;li&gt;DDD principles for structured domain logic&lt;/li&gt;
&lt;li&gt;CQRS using MediatR for command-query separation&lt;/li&gt;
&lt;li&gt;Dynamic Database Selection (SQL Server, PostgreSQL, MySQL, SQLite)&lt;/li&gt;
&lt;li&gt;Entity Framework Core for data persistence&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Prerequisites
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Visual Studio or VS Code&lt;/li&gt;
&lt;li&gt;.NET 9 SDK&lt;/li&gt;
&lt;li&gt;Database based on your need.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  About the Project
&lt;/h3&gt;

&lt;p&gt;This project is a .NET 9 Web API designed with Clean Architecture principles and Domain-Driven Design (DDD). It follows the CQRS pattern using MediatR and supports dynamic database selection using Entity Framework Core. The project is structured into multiple layers for maintainability and scalability:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;WebAPI Layer: Handles HTTP requests and routes them to the application layer.&lt;/li&gt;
&lt;li&gt;Application Layer: Contains business logic, DTOs, and CQRS commands/queries.&lt;/li&gt;
&lt;li&gt;Domain Layer: Defines core entities and domain logic.&lt;/li&gt;
&lt;li&gt;Infrastructure Layer: Manages database context, dependency injection, and configurations.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The main objective of this project is to allow users to select a database dynamically via configuration, making the API flexible and adaptable for different deployment scenarios.&lt;/p&gt;

&lt;p&gt;Complete source code: &lt;a href="https://github.com/rijwanansari/DotNet9DyanmicDatabase" rel="noopener noreferrer"&gt;Click Here&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Let’s start with the implementation.&lt;/p&gt;

&lt;h3&gt;
  
  
  Create the Solution and Projects
&lt;/h3&gt;

&lt;p&gt;We can create solution and projects from UI or through command. The project structure should be as shown below:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjr3ut34m1tnr1ae1hgax.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjr3ut34m1tnr1ae1hgax.png" alt="Image description" width="554" height="429"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;DynamicDatabaseApp – Solution&lt;/li&gt;
&lt;li&gt;WebAPI – ASP.NET Web API (.NET 9)&lt;/li&gt;
&lt;li&gt;Application – Class Library – .NET 9&lt;/li&gt;
&lt;li&gt;Doman – Class Library – .NET 9&lt;/li&gt;
&lt;li&gt;Infrastructure – Class Library – .NET 9
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;mkdir DynamicDatabaseApp &amp;amp;&amp;amp; cd DynamicDatabaseApp
dotnet new sln -n DynamicDatabaseAPI

dotnet new webapi -n WebAPI
dotnet new classlib -n Application
dotnet new classlib -n Domain
dotnet new classlib -n Infrastructure

dotnet sln add src/WebAPI src/Application src/Domain src/Infrastructure

dotnet add src/WebAPI reference src/Application src/Infrastructure

dotnet add src/Application reference src/Domain

dotnet add src/Infrastructure reference src/Domain
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Add Project references as shown:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;WebAPI – Application, Infrastructure&lt;/li&gt;
&lt;li&gt;Application – Domain&lt;/li&gt;
&lt;li&gt;Infrastructure – Application&lt;/li&gt;
&lt;li&gt;Domian – none.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Install Required NuGet Packages&lt;/strong&gt;&lt;br&gt;
Let’s Add the necessary packages for the project.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;WebAPI: Microsoft.EntityFrameworkCore.Design&lt;/li&gt;
&lt;li&gt;Application: MediatR, Microsoft.EntityFrameworkCore, Microsoft.Extensions.DependencyInjection&lt;/li&gt;
&lt;li&gt;Infrastructure: Microsoft.EntityFrameworkCore, Microsoft.EntityFrameworkCore.InMemory, Microsoft.EntityFrameworkCore.Sqlite, Microsoft.EntityFrameworkCore.SqlServer, Npgsql.EntityFrameworkCore.PostgreSQL, Pomelo.EntityFrameworkCore.MySql, Microsoft.Extensions.Configuration, Microsoft.Extensions.DependencyInjection&lt;/li&gt;
&lt;li&gt;Domain: none.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You can add the packages form UI or command.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;dotnet add src/WebAPI package Microsoft.EntityFrameworkCore.Design

dotnet add src/Application package MediatR
dotnet add src/Application package Microsoft.EntityFrameworkCore
dotnet add src/Application package Microsoft.Extensions.DependencyInjection

dotnet add src/Infrastructure package Microsoft.Extensions.DependencyInjection
dotnet add src/Infrastructure package Microsoft.EntityFrameworkCore.Design
dotnet add src/Infrastructure package Microsoft.EntityFrameworkCore
dotnet add src/Infrastructure package Microsoft.EntityFrameworkCore.Sqlite
dotnet add src/Infrastructure package Microsoft.EntityFrameworkCore.SqlServer
dotnet add src/Infrastructure package Npgsql.EntityFrameworkCore.PostgreSQL
dotnet add src/Infrastructure package Pomelo.EntityFrameworkCore.MySql
dotnet add src/Infrastructure package Microsoft.Extensions.Configuration
dotnet add src/Infrastructure package Microsoft.Extensions.DependencyInjection
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We created a project structure following Clean Architecture and added the necessary references.&lt;/p&gt;

&lt;h3&gt;
  
  
  Implementing the Layers
&lt;/h3&gt;

&lt;h3&gt;
  
  
  Define the Domain Layer (Domain)
&lt;/h3&gt;

&lt;p&gt;*&lt;em&gt;Entity *&lt;/em&gt;– User.cs&lt;br&gt;
&lt;/p&gt;

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

public class User
{
    public Guid Id { get; set; }
    public string Name { get; set; } = string.Empty;
    public string Email { get; set; } = string.Empty;

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

&lt;/div&gt;



&lt;h3&gt;
  
  
  Define the Application Layer (Application)
&lt;/h3&gt;

&lt;p&gt;Create &lt;em&gt;IApplicationDbContext.cs&lt;/em&gt; class in Common/Interfaces folder.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;using Domain;
using Microsoft.EntityFrameworkCore;

namespace Application.Common.Interfaces;

public interface IApplicationDbContext
{
    DbSet&amp;lt;User&amp;gt; Users { get; }
    Task&amp;lt;int&amp;gt; SaveChangesAsync(CancellationToken cancellationToken = default);

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

&lt;/div&gt;



&lt;p&gt;Create UserDto.cs under User/Dto folder.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;namespace Application.Users.Dto;

public record UserDto
{
    public string Name { get; set; } = string.Empty;
    public string Email { get; set; } = string.Empty;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Command – CreateUserCommand.cs in folder User/Create&lt;br&gt;
&lt;/p&gt;

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

namespace Application.Users.Create;

public class CreateUserCommand : IRequest&amp;lt;Guid&amp;gt;
{
    public string Name { get; set; } = string.Empty;
    public string Email { get; set; } = string.Empty;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Command Handler – CreateUserCommandHandler.cs in folder User/Create&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;using Application.Common.Interfaces;
using Domain;
using MediatR;

namespace Application.Users.Create;

public class CreateUserCommandHandler(IApplicationDbContext dbContext) : IRequestHandler&amp;lt;CreateUserCommand, Guid&amp;gt;
{
    public async Task&amp;lt;Guid&amp;gt; Handle(CreateUserCommand request, CancellationToken cancellationToken)
    {
        var user = new User
        {
            Id = Guid.NewGuid(),
            Name = request.Name,
            Email = request.Email
        };

        dbContext.Users.Add(user);
        await dbContext.SaveChangesAsync(cancellationToken);

        return user.Id;

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

&lt;/div&gt;



&lt;p&gt;For Dependency Injection, add DependencyInjection.cs&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;using Microsoft.Extensions.DependencyInjection;

namespace Application;

public static class DependencyInjection
{
    public static IServiceCollection AddApplication(this IServiceCollection services)
    {
        services.AddMediatR(config =&amp;gt;
        {
            config.RegisterServicesFromAssembly(typeof(DependencyInjection).Assembly);
        });

        return services;
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The Application project should be as illustrated below:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqtde9jltlxe6yrtvv9dz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqtde9jltlxe6yrtvv9dz.png" alt="Image description" width="595" height="590"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Implement the Infrastructure Layer (Infrastructure)
&lt;/h3&gt;

&lt;p&gt;Database Context – AppDbContext.cs (under Persistence folder)&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;using Application.Common.Interfaces;
using Domain;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.ChangeTracking;

namespace Infrastructure.Persistence;

public class AppDbContext (DbContextOptions&amp;lt;AppDbContext&amp;gt; options)
    : DbContext(options), IApplicationDbContext
{
    public DbSet&amp;lt;User&amp;gt; Users { get; set; } = null!;

    public override Task&amp;lt;int&amp;gt; SaveChangesAsync(CancellationToken cancellationToken = default)
    {
        ChangeTracker.DetectChanges();
        return base.SaveChangesAsync(cancellationToken);
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;DependencyInjection.cs&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;using Infrastructure.Persistence;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.EntityFrameworkCore;
using Application.Common.Interfaces;

namespace Infrastructure;

public static class DependencyInjection
{
    public static IServiceCollection AddInfrastructure(this IServiceCollection services, IConfiguration configuration)
    {
        string dbType = configuration["Database:Type"] ?? string.Empty;

        services.AddDbContext&amp;lt;AppDbContext&amp;gt;(options =&amp;gt;
        {
            switch (dbType)
            {
                case "SQLServer":
                    options.UseSqlServer(configuration.GetConnectionString("SqlServerConnection"));
                    break;
                case "PostgreSQL":
                    options.UseNpgsql(configuration.GetConnectionString("PostgresConnection"));
                    break;
                case "MySQL":
                    options.UseMySql(configuration.GetConnectionString("MySqlConnection"), ServerVersion.AutoDetect(configuration.GetConnectionString("MySqlConnection")));
                    break;
                case "SQLite":
                    options.UseSqlite(configuration.GetConnectionString("MySqlLiteConnection"));
                    break; 
                case "InMemory":
                    options.UseInMemoryDatabase("InMemoryDbForTesting");
                    break; 

                default: throw new Exception("Invalid database type");
            }

        });

        services.AddScoped&amp;lt;IApplicationDbContext&amp;gt;(sp =&amp;gt; sp.GetRequiredService&amp;lt;AppDbContext&amp;gt;());

        return services;
    }

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

&lt;/div&gt;



&lt;p&gt;The &lt;em&gt;DependencyInjection&lt;/em&gt; class provides a centralized way to register different database providers (SQL Server, PostgreSQL, MySQL, SQLite, and In-Memory) based on configuration. This approach allows seamless database switching without modifying the core application logic, improving scalability, cost-effectiveness, and deployment flexibility.&lt;/p&gt;

&lt;p&gt;Infrastructure Project:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1ryox3bojdr9vinorjic.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1ryox3bojdr9vinorjic.png" alt="Image description" width="606" height="521"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Presentation layer (WebAPI)
&lt;/h3&gt;

&lt;p&gt;For above dynamic database configuration, we will add the configuration values in appsettings.json&lt;/p&gt;

&lt;p&gt;appsettings.json&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
  "Database": {
    "Type": "SqlServer"
  },
  "ConnectionStrings": {
    "SqlServer": "Server=.;Database=MyDb;Trusted_Connection=True;MultipleActiveResultSets=true",
    "PostgreSQL": "Host=localhost;Database=mydb;Username=myuser;Password=mypassword",
    "MySQL": "Server=localhost;Database=mydb;User=root;Password=mypassword;",
    "SQLite": "Data Source=mydatabase.db"
  },
  "Logging": {
    "LogLevel": {
      "Default": "Information",
      "Microsoft.AspNetCore": "Warning"
    }
  },
  "AllowedHosts": "*"
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Add UserController.cs under Contollers folder&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;using Application.Users.Create;
using MediatR;
using Microsoft.AspNetCore.Mvc;

namespace WebAPI.Controllers
{
    [Route("api/[controller]")]
    [ApiController]
    public class UserController (IMediator mediator) : ControllerBase
    {
        private readonly IMediator _mediator = mediator;

        [HttpPost]
        public async Task&amp;lt;ActionResult&amp;lt;Guid&amp;gt;&amp;gt; CreateUser(CreateUserCommand command)
        {
            var userId = await _mediator.Send(command);

            return Ok(userId);
        }

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

&lt;/div&gt;



&lt;p&gt;Register services in program.cs&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;builder.Services
    .AddApplication()
    .AddInfrastructure(builder.Configuration);

....

app.MapControllers();
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Complete program.cs file.&lt;br&gt;
&lt;/p&gt;

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

var builder = WebApplication.CreateBuilder(args);

// Add services to the container.
// Learn more about configuring OpenAPI at https://aka.ms/aspnet/openapi
builder.Services.AddOpenApi();

builder.Services
    .AddApplication()
    .AddInfrastructure(builder.Configuration);

builder.Services.AddEndpointsApiExplorer();

var app = builder.Build();

// Configure the HTTP request pipeline.
if (app.Environment.IsDevelopment())
{
    app.MapOpenApi();
}
app.MapControllers();

app.UseHttpsRedirection();

app.Run();
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;WebAPI Project:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fylgtc4l2cvgle6o33jcw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fylgtc4l2cvgle6o33jcw.png" alt="Image description" width="530" height="529"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;That’s all. Now, we did the dynamic database for the application. You can do configuration in database and do migrations accordingly.&lt;/p&gt;

&lt;p&gt;Complete Project Structure:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fq5pevflp9pvx2b6grfnj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fq5pevflp9pvx2b6grfnj.png" alt="Image description" width="661" height="881"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Complete source code: &lt;a href="https://github.com/rijwanansari/DotNet9DyanmicDatabase" rel="noopener noreferrer"&gt;Click Here&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Implementing dynamic database selection in a .NET 8 Web API using Clean Architecture, DDD, MediatR, and Entity Framework Core provides a flexible, scalable, and future-proof solution for modern applications. By leveraging appsettings.json to configure different database providers, developers can easily switch between SQL Server, PostgreSQL, MySQL, SQLite, and In-Memory databases without altering the core application logic.&lt;/p&gt;

&lt;p&gt;This approach enhances maintainability, cost-efficiency, and adaptability, making it ideal for multi-tenant applications, microservices, and cloud-based deployments. Whether you’re developing for local testing, production environments, or multi-database support, this architecture ensures seamless database integration.&lt;/p&gt;

&lt;p&gt;By adopting this strategy, your application remains robust, vendor-independent, and ready to scale, empowering developers to build high-quality, dynamic APIs with ease.&lt;/p&gt;

</description>
      <category>dotnet</category>
      <category>solutiondesign</category>
      <category>webapi</category>
      <category>programming</category>
    </item>
    <item>
      <title>Creating A Reusable Dynamic Pagination Component in Blazor</title>
      <dc:creator>Rijwan Ansari</dc:creator>
      <pubDate>Mon, 26 Aug 2024 17:01:20 +0000</pubDate>
      <link>https://dev.to/rijwanansari/creating-a-reusable-dynamic-pagination-component-in-blazor-3hgb</link>
      <guid>https://dev.to/rijwanansari/creating-a-reusable-dynamic-pagination-component-in-blazor-3hgb</guid>
      <description>&lt;p&gt;Blazor is a modern web framework developed by Microsoft that is changing the way developers build interactive web applications. Blazor lets you build rich client-side web experiences using C# and .NET instead of JavaScript. One of the most powerful features of Blazor is its component-based architecture, which encourages the reuse of code and modular design. This article will show you how to create a reusable dynamic pagination component with Blazor, ensuring minimal changes and maximum flexibility.&lt;/p&gt;

&lt;p&gt;To know more about Blazor Web Development &lt;a href="https://rijsat.com/what-is-blazor-web-development/" rel="noopener noreferrer"&gt;Click Here&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Understanding Blazor and Its Component-Based Architecture
&lt;/h2&gt;

&lt;p&gt;Blazor is part of the ASP.NET Core framework, and it allows you to develop full-stack web applications with .NET. Blazor provides a unified programming model that lets you use your .NET skills across the stack, whether you’re building server-side or client-side applications.&lt;/p&gt;

&lt;p&gt;Blazor differs from traditional web frameworks by running .NET code in the browser (Blazor WebAssembly) or on the server with SignalR (Blazor Server). This removes the need for JavaScript in many scenarios, providing a more seamless development experience for .NET developers.&lt;/p&gt;

&lt;h3&gt;
  
  
  Component-Based Framework
&lt;/h3&gt;

&lt;p&gt;Blazor is a component based framework at its core. In Blazor, everything is a component, from a simple button to a complex data grid. Components are self-contained units of user interface and behavior that can be reused throughout the entire application. They allow developers to encapsulate their HTML, CSS and C# code in one location, which promotes reusability, maintainability and testability.&lt;/p&gt;

&lt;p&gt;Components can be nested, set parameters and even share data with each other. This makes Blazor an ideal framework for building modular and dynamic web applications. Once created, components can be used anywhere in the application and are written as .razor files.&lt;/p&gt;

&lt;p&gt;In this article, we create a pagination component which can be reused across the application dynamically for any list or collection.&lt;/p&gt;

&lt;h2&gt;
  
  
  Pagination in Web Applications
&lt;/h2&gt;

&lt;p&gt;In web applications that deal with large amounts of data, pagination is a common feature. This enables you to split your data into pages, so that users can browse more easily without overwhelming them with lengthy lists. Correct pagination improves the user experience because it improves performance, reduces page loading time, and makes data easier to digest.&lt;/p&gt;

&lt;p&gt;You can implement both client-side and server-side pagination approaches in Blazor. In this article, our focus will be on the creation of a reusable client-side pagination component that can be easily integrated into any Blazor application.&lt;/p&gt;

&lt;p&gt;Complete Source Code: &lt;a href="https://github.com/rijwanansari/DynamicPagination" rel="noopener noreferrer"&gt;https://github.com/rijwanansari/DynamicPagination&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Creating a Reusable Dynamic Pagination Component
&lt;/h2&gt;

&lt;p&gt;Let’s walk through the process of building a reusable pagination component in Blazor that supports dynamic page size selection and navigation.&lt;/p&gt;

&lt;p&gt;Create a Blazor Web App project template using Visual Studio or VS Code and give a name.&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%2Fuploads%2Farticles%2Ff06ld5hk3oci9ad3z6p7.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%2Fuploads%2Farticles%2Ff06ld5hk3oci9ad3z6p7.png" alt="Blazor"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can choose any .NET Core framework. However, for this article, I have used .NET 8.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Defining the Pagination Component&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Create a Blazor component in a shared folder or any folder of your choice where you can share across the project easily.&lt;/p&gt;

&lt;p&gt;The first step is to define the PaginationComponent. This component will handle the pagination logic and display the necessary controls, such as page numbers and page size options.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;&lt;strong&gt;PaginationComponent.razor&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;

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

@typeparam TItem

&amp;lt;div&amp;gt;
    &amp;lt;table class="table"&amp;gt;
        &amp;lt;thead&amp;gt;
            @ChildContentHeader
        &amp;lt;/thead&amp;gt;
        &amp;lt;tbody&amp;gt;
            @foreach (var item in PaginatedData)
            {
                @ChildContentRow(item)
            }
        &amp;lt;/tbody&amp;gt;
    &amp;lt;/table&amp;gt;

    &amp;lt;div class="pagination-controls"&amp;gt;
        &amp;lt;!-- Page Size Dropdown --&amp;gt;
        &amp;lt;label for="pageSize"&amp;gt;Page Size: &amp;lt;/label&amp;gt;
        &amp;lt;select @bind="PageSize" id="pageSize"&amp;gt;
            @foreach (var size in PageSizes)
            {
                &amp;lt;option value="@size"&amp;gt;@size&amp;lt;/option&amp;gt;
            }
        &amp;lt;/select&amp;gt;

        &amp;lt;!-- Previous Page Button --&amp;gt;
        &amp;lt;button @onclick="PreviousPage" disabled="@IsPreviousDisabled"&amp;gt;Previous&amp;lt;/button&amp;gt;

        &amp;lt;!-- Page Number Buttons --&amp;gt;
        @foreach (var pageNumber in Enumerable.Range(1, TotalPages))
        {
            &amp;lt;button @onclick="() =&amp;gt; GoToPage(pageNumber)" class="@(CurrentPage == pageNumber ? "active" : "")"&amp;gt;
                @pageNumber
            &amp;lt;/button&amp;gt;
        }

        &amp;lt;!-- Next Page Button --&amp;gt;
        &amp;lt;button @onclick="NextPage" disabled="@IsNextDisabled"&amp;gt;Next&amp;lt;/button&amp;gt;
    &amp;lt;/div&amp;gt;
&amp;lt;/div&amp;gt;

@code {
    [Parameter] public IEnumerable&amp;lt;TItem&amp;gt; Items { get; set; }
    [Parameter] public int DefaultPageSize { get; set; } = 10;
    [Parameter] public RenderFragment ChildContentHeader { get; set; }
    [Parameter] public RenderFragment&amp;lt;TItem&amp;gt; ChildContentRow { get; set; }

    private int PageSize { get; set; }
    private List&amp;lt;TItem&amp;gt; PaginatedData =&amp;gt; Items.Skip((CurrentPage - 1) * PageSize).Take(PageSize).ToList();
    private int CurrentPage { get; set; } = 1;

    private readonly int[] PageSizes = new[] { 5, 10, 20, 50 };

    protected override void OnInitialized()
    {
        PageSize = DefaultPageSize;
    }

    private void NextPage()
    {
        if (CurrentPage &amp;lt; TotalPages)
        {
            CurrentPage++;
        }
    }

    private void PreviousPage()
    {
        if (CurrentPage &amp;gt; 1)
        {
            CurrentPage--;
        }
    }

    private void GoToPage(int pageNumber)
    {
        CurrentPage = pageNumber;
    }

    private int TotalPages =&amp;gt; (int)Math.Ceiling(Items.Count() / (double)PageSize);

    private bool IsPreviousDisabled =&amp;gt; CurrentPage == 1;
    private bool IsNextDisabled =&amp;gt; CurrentPage == TotalPages;
}



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

&lt;/div&gt;

&lt;p&gt;In this component, we have the following items.&lt;/p&gt;

&lt;p&gt;@typeparam TItem: This allows the component to be generic, meaning it can work with any data type (TItem). It makes the component flexible and reusable with different types of data, such as Product, Employee, etc.&lt;/p&gt;

&lt;p&gt;Items, ChildContentHeader, and ChildContentRow Parameters:&lt;/p&gt;

&lt;p&gt;Items: This is a collection of data (IEnumerable) passed into the component. The component uses this data to display paginated content.&lt;br&gt;
ChildContentHeader: This is a render fragment for the table header. It allows the parent component to define how the header should be rendered.&lt;br&gt;
ChildContentRow: This is a render fragment for each row of data. It takes a TItem and allows the parent component to define how each item should be displayed.&lt;br&gt;
Pagination Logic: The component calculates which items to display based on the current page and page size.&lt;/p&gt;

&lt;p&gt;PaginatedData: This property uses LINQ to skip items and take only those that should be displayed on the current page.&lt;br&gt;
PageSize and PageSizes: PageSize controls how many items are displayed per page, and PageSizes defines the available options for page size.&lt;br&gt;
NextPage, PreviousPage, and GoToPage: These methods handle navigation between pages.&lt;br&gt;
Pagination Controls: The component includes buttons for navigating between pages (Next and Previous) and buttons for selecting specific pages. There’s also a dropdown for selecting the page size.&lt;/p&gt;

&lt;p&gt;We will CSS file for this component as shown to add style for the controls like page, page buttons, previous and next buttons and below pagination sections.&lt;/p&gt;

&lt;p&gt;CSS for this pagination controls is shared below.&lt;/p&gt;

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

.pagination-controls
{
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 20px;
}

.pagination-controls button {
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    color: #007bff;
    padding: 5px 10px;
    margin: 0 5px;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s ease, color 0.3s ease;
}

    .pagination-controls button:hover {
        background-color: #007bff;
        color: white;
    }

    .pagination-controls button.active {
        background-color: #007bff;
        color: white;
        font-weight: bold;
    }

    .pagination-controls button:disabled {
        background-color: #e9ecef;
        color: #6c757d;
        cursor: not-allowed;
        border-color: #ced4da;
    }

.pagination-controls select {
    margin-right: 15px;
    padding: 5px;
    border-radius: 4px;
    border: 1px solid #dee2e6;
}

.pagination-controls label {
    margin-right: 5px;
    font-weight: bold;
}



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

&lt;/div&gt;

&lt;p&gt;This CSS ensures that the pagination controls have a clean, modern look with smooth transitions when users interact with them.&lt;/p&gt;

&lt;p&gt;Using the Pagination Component&lt;br&gt;
Once the PaginationComponent is defined, you can easily integrate it into your Blazor pages or components. Here’s an example of how to use it with a list of products.&lt;/p&gt;

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

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

//sample dummy data
public class ProductService
{
    public List&amp;lt;Product&amp;gt; GetProducts()
    {
        // Sample data
        return Enumerable.Range(1, 100).Select(i =&amp;gt; new Product
        {
            Id = i,
            Name = $"Product {i}",
            Price = i * 10
        }).ToList();
    }
}



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

&lt;/div&gt;

&lt;p&gt;We can use the pagination component as illustrated.&lt;/p&gt;

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

@page "/"
@using DynamicPagination.Components.Shared
@using DynamicPagination.Model
@inject ProductService ProductService
@rendermode RenderMode.InteractiveServer

&amp;lt;h3&amp;gt;Product List&amp;lt;/h3&amp;gt;

&amp;lt;PaginationComponent TItem="Product" Items="Products" DefaultPageSize="10"&amp;gt;
    &amp;lt;ChildContentHeader&amp;gt;
        &amp;lt;tr&amp;gt;
            &amp;lt;th&amp;gt;Id&amp;lt;/th&amp;gt;
            &amp;lt;th&amp;gt;Name&amp;lt;/th&amp;gt;
            &amp;lt;th&amp;gt;Price&amp;lt;/th&amp;gt;
        &amp;lt;/tr&amp;gt;
    &amp;lt;/ChildContentHeader&amp;gt;
    &amp;lt;ChildContentRow Context="product"&amp;gt;
        &amp;lt;tr&amp;gt;
            &amp;lt;td&amp;gt;@product.Id&amp;lt;/td&amp;gt;
            &amp;lt;td&amp;gt;@product.Name&amp;lt;/td&amp;gt;
            &amp;lt;td&amp;gt;@product.Price&amp;lt;/td&amp;gt;
        &amp;lt;/tr&amp;gt;
    &amp;lt;/ChildContentRow&amp;gt;
&amp;lt;/PaginationComponent&amp;gt;

@code {
    private List&amp;lt;Product&amp;gt; Products;

    protected override void OnInitialized()
    {
        Products = ProductService.GetProducts();
    }
}



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

&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;How It Works&lt;/strong&gt;&lt;br&gt;
In the above sample, the PaginationComponent takes in a list of products and renders a paginated table. The ChildContentHeader defines the table’s headers, while ChildContentRow specifies how each row of data should be rendered. The component handles the pagination logic, allowing users to navigate through pages and change the number of items displayed per page.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Output:&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%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9nx9179ze72twadrlvav.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%2Fuploads%2Farticles%2F9nx9179ze72twadrlvav.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Benefits of a Reusable Pagination Component
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Consistency:&lt;/strong&gt; Once the component is defined, it can be reused across multiple pages, ensuring a consistent pagination experience throughout the application.&lt;br&gt;
&lt;strong&gt;Customization:&lt;/strong&gt; The component can be easily customized to fit different use cases by modifying parameters such as page size, styling, or behavior.&lt;br&gt;
&lt;strong&gt;Maintenance:&lt;/strong&gt; Any changes to the pagination logic or design need to be made only once within the component, reducing maintenance overhead.&lt;br&gt;
Complete Source Code: &lt;a href="https://github.com/rijwanansari/DynamicPagination" rel="noopener noreferrer"&gt;https://github.com/rijwanansari/DynamicPagination&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Bottom Line
&lt;/h2&gt;

&lt;p&gt;The component-based architecture of Blazor allows developers to create modular, reusable components that can significantly streamline the development process. You can improve the user experience of your application and make your code more maintainable by creating a reusable dynamic pagination component. This approach allows you to focus on delivering value to your users, ensuring that your Blazor application is both efficient and easy to scale.&lt;/p&gt;

&lt;p&gt;The principles outlined here will help you create flexible, reusable components that can adapt to different scenarios, whether you’re working on a small project or a large enterprise application. Stay tuned for the next article, where we’ll explore building a server-side pagination component.&lt;/p&gt;

</description>
      <category>blazor</category>
      <category>aspnet</category>
      <category>dotnet</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Empowering Developers: AI as a Valuable Tool, Not a Substitute</title>
      <dc:creator>Rijwan Ansari</dc:creator>
      <pubDate>Sat, 03 Feb 2024 07:20:06 +0000</pubDate>
      <link>https://dev.to/rijwanansari/empowering-developers-ai-as-a-valuable-tool-not-a-substitute-359d</link>
      <guid>https://dev.to/rijwanansari/empowering-developers-ai-as-a-valuable-tool-not-a-substitute-359d</guid>
      <description>&lt;p&gt;In the ever-changing world of software development, using Artificial Intelligence (AI) doesn’t mean replacing developers; it’s about giving them more power. Think of AI as a handy tool that makes developers more efficient, helps them work better, and boosts their skills. This new way of thinking is crucial for handling the challenges of different projects. It ensures that developers stay leaders in coming up with new ideas and solving tricky problems, all while working alongside AI to create innovative solutions. It’s like having a smart assistant that makes the whole development process smoother and more effective.&lt;/p&gt;

&lt;h2&gt;
  
  
  Problem Statement
&lt;/h2&gt;

&lt;p&gt;As the lead of development, juggling numerous projects with diverse scopes, proposals, solutions, and technical specifications poses a significant challenge. The documentation, including Software Requirement Specifications (SRS), proposals, and terms, is scattered across various projects, spanning multiple years. Remembering specific details for each project, even with ongoing support and enhancements, can be discouraging, potentially leading to mismatches and inefficiencies.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&amp;gt; Going through lots of SRS, proposals, and terms from various years is a real hassle. It takes up a lot of time to sift through these documents and find the information I need.&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Simple Solution: An Intelligent BOT using Azure OpenAI and Azure Cognitive Search
&lt;/h2&gt;

&lt;p&gt;We can build an intelligent bot using our own data with Azure OpenAI and Cognitive search, as shown in the below diagram.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyy87hjp8el0ur2rgk35m.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyy87hjp8el0ur2rgk35m.jpg" alt="Image description" width="800" height="384"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;To address and simplify this complexity, I’ve introduced an intelligent &lt;strong&gt;Chat Bot&lt;/strong&gt;. It effortlessly integrates with our Azure Storage Account, the centralized hub for all SRS and proposal files. By harnessing the capabilities of &lt;strong&gt;Azure OpenAI through Azure Cognitive Search&lt;/strong&gt;, the Chat Bot revolutionizes our approach to interacting with project details.&lt;/p&gt;

&lt;p&gt;On other words, we can bring our own data to smart BOT like ChatGPT.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Upload your data in &lt;strong&gt;Azure Blob Storage&lt;/strong&gt; (files: SRS, Proposals etc.)&lt;/li&gt;
&lt;li&gt;Go to Playground Chat from &lt;strong&gt;Azure OpenAI Studio&lt;/strong&gt; (or Azure AI Studio preview)&lt;/li&gt;
&lt;li&gt;Choose the option Add your Data and provide data source of Azure &lt;strong&gt;Blob Storage with Azure Cognitive Search&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;It will take some time to train the model based on the data volume.&lt;/li&gt;
&lt;li&gt;That’s all, now we can do queries with your BOT. You will be amazed by the responses.&lt;/li&gt;
&lt;li&gt;We can simply deploy to &lt;strong&gt;Azure Web App or Power Virtual Agent BOT&lt;/strong&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fa2a3hyjl5ih024b5yze9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fa2a3hyjl5ih024b5yze9.png" alt="Image description" width="800" height="393"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Furthermore, we can bring or integrate with any applications like MS Teams, Web, and other platforms with an option to view code.&lt;/p&gt;

&lt;p&gt;This AI BOT servers as a powerful tool with following advantages.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Effortless Retrieval:&lt;/strong&gt; Quickly recalls any Software Requirement Specification (SRS) or proposal, providing an overview on demand, saving significant time.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Summarization Magic:&lt;/strong&gt; Summarizes complex documents effectively, making the content more digestible and easily understandable.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Requirements Validation:&lt;/strong&gt; Assists in validating project requirements, ensuring clarity and accuracy.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Use Case Query:&lt;/strong&gt; Responds to and validates use cases, helping maintain a clear understanding of project needs.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Client Request Validation:&lt;/strong&gt; Validates client requests against SRS, ensuring alignment with the documented project scope.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Bug and Change Request Validation:&lt;/strong&gt; Efficiently validates bugs and change requests, contributing to a smoother development process.&lt;/li&gt;
&lt;li&gt;Generate Test Scripts&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Client Query Response:&lt;/strong&gt; Provides prompt responses to client queries, enhancing communication and client satisfaction.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Solution Design and Technology Overview:&lt;/strong&gt; Offers insights into solution design and employed technologies, facilitating a comprehensive understanding.&lt;/li&gt;
&lt;li&gt;**Timeline and Proposal Details Inquiry: **Assists in inquiries related to project timelines and proposal details, contributing to better project management.&lt;/li&gt;
&lt;li&gt;and many more to uncover&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;We can further enhance the BOT by including documents related to project management, UAT, Test Scripts, Technical and user guide.&lt;/p&gt;

&lt;p&gt;In summary, AI is one of the most powerful tool to boost our efficiency and productivity, specially in the fast-paced world of software development. This means seeing AI as a valuable assistant that makes developers more efficient, simplifies complex processes, writing program and enhances their skills.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>openai</category>
      <category>azure</category>
      <category>machinelearning</category>
    </item>
    <item>
      <title>How To Upload and Delete files in Azure Blob Storage Using Blazor Apps With .NET 7</title>
      <dc:creator>Rijwan Ansari</dc:creator>
      <pubDate>Fri, 03 Mar 2023 09:31:48 +0000</pubDate>
      <link>https://dev.to/rijwanansari/how-to-upload-and-delete-files-in-azure-blob-storage-using-blazor-apps-with-net-7-1oka</link>
      <guid>https://dev.to/rijwanansari/how-to-upload-and-delete-files-in-azure-blob-storage-using-blazor-apps-with-net-7-1oka</guid>
      <description>&lt;p&gt;One of the main components of the Digital transformation journey is storing and managing files and documents securely. Most of the applications require some features related to file upload and managing. We generally look for secure, durable, scalable, and high availability. Moreover, storing documents requires high storage space and a highly secure platform.&lt;/p&gt;

&lt;p&gt;Uploading files or attachments is one of the common requirements for any application. Azure storage is one of the most efficient cloud storage with all the necessary features, securities, and compliance.&lt;/p&gt;

&lt;p&gt;Azure Storage, a platform owned by Microsoft, is a contemporary cloud storage solution for almost every case scenario that is highly secure, scalable, durable, and easy to manage.&lt;/p&gt;

&lt;p&gt;In this article, we will learn about Azure Storage and its data services. Additionally, we will create an azure storage data service with an example of Azure Blobs. Furthermore, we will upload, delete, and view files to Azure Blobs with Blazor application in .NET 7. The outline of this article are follows:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;What is Azure Storage&lt;/li&gt;
&lt;li&gt;What are the Azure Storage data services?&lt;/li&gt;
&lt;li&gt;How to create an Azure Storage Account?&lt;/li&gt;
&lt;li&gt;.NET Generally available&lt;/li&gt;
&lt;li&gt;What is a Blazor Web App?&lt;/li&gt;
&lt;li&gt;Create a Blazor Web App with .NET 7&lt;/li&gt;
&lt;li&gt;Upload, delete and view files in Azure Blobs using a Blazor App in .NET 7
You can find a complete Solution on GitHub, &lt;a href="https://github.com/rijwanansari/RijsatFileUploadAzureStorage" rel="noopener noreferrer"&gt;Click Here&lt;/a&gt;.
&lt;a href="https://github.com/rijwanansari/RijsatFileUploadAzureStorage" rel="noopener noreferrer"&gt;https://github.com/rijwanansari/RijsatFileUploadAzureStorage&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Azure Storage
&lt;/h2&gt;

&lt;p&gt;Azure Storage is a modern cloud storage solution owned by Microsoft, for almost every data storage scenario that is highly secure, scalable, durable, and easy to manage. It is well managed for hardware, updates, critical issues, high availability and is accessible from any part of the globe. Furthermore, the Azure UI is user-friendly, and we can create the services/objects effortlessly with all the configuration features. Additionally, Azure Storage provides all the necessary client libraries/SDK in .NET, Python, JavaScript, Java C++, PHP, Node.js, Ruby, Go, therefore developers can simply implement in their applications using the programming language of their choice. We can even access the storage objects via HTTP, HTTPS or REST API. Azure CLI or Azure PowerShell can be used by IT professionals to create scripts for those services and configuration tasks.&lt;/p&gt;

&lt;p&gt;Let’s discuss Azure Storage Data Services.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F99cc4wgc8n0fyguug7l1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F99cc4wgc8n0fyguug7l1.png" alt="Upload and Delete files in Azure Blob Storage" width="800" height="404"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Azure Storage Data Services
&lt;/h2&gt;

&lt;p&gt;Azure storage consists of 5 data services, as portrayed in the above diagram.&lt;/p&gt;

&lt;h2&gt;
  
  
  Azure Blob Storage
&lt;/h2&gt;

&lt;p&gt;Azure Blob Storage is a type of Azure Storage for storing massively scalable objects that are, particularly unstructured data such as text or binary data. It is used to store and access those unstructured data at a massive scale of block blobs. You can access the blob files via any applications using client libraries for multiple programming languages like .NET, Python, Java, Node.js, Ruby and PHP. Furthermore, we can use HTTP service access globally with secure access.&lt;/p&gt;

&lt;h2&gt;
  
  
  Scenarios to Use Azure Blob Storage
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Storing files and document form various applications&lt;/li&gt;
&lt;li&gt;Storing large file&lt;/li&gt;
&lt;li&gt;Streaming video and audio files&lt;/li&gt;
&lt;li&gt;Accessing files and images from browser&lt;/li&gt;
&lt;li&gt;Storing file for backup, archiving, disaster recovery&lt;/li&gt;
&lt;li&gt;Access file from anywhere globally via HTTP service&lt;/li&gt;
&lt;li&gt;Distributed access to files and documents&lt;/li&gt;
&lt;li&gt;Secure Access
​&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Azure Files
&lt;/h2&gt;

&lt;p&gt;Azure Files Service provides a fully managed serverless file sharing option in the cloud via the industry-standard SMB and NFS protocols. Azure files enables us to build a truly hybrid file sharing environment from anywhere by mounting it concurrently from on premises and cloud.  &lt;/p&gt;

&lt;p&gt;​To know more details: &lt;a href="https://azure.microsoft.com/en-us/products/storage/files/" rel="noopener noreferrer"&gt;https://azure.microsoft.com/en-us/products/storage/files/&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Azure Tables
&lt;/h2&gt;

&lt;p&gt;This storage table is used for storing large amount of non-relational structured or semi-structured data, i.e. NoSQL key-value for speedy development. This is highly efficient for the applications that require flexible data schema and massive data in the cloud.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://learn.microsoft.com/en-us/azure/storage/tables/table-storage-overview" rel="noopener noreferrer"&gt;https://learn.microsoft.com/en-us/azure/storage/tables/table-storage-overview&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Azure Queues
&lt;/h2&gt;

&lt;p&gt;This storage service is used for storing and queuing a large number of messages that can be accessed from any part of the globe via authenticated HTTP service calls. ​The Azure Queue storage provides messaging among the applications in the cloud and can be used in any programming language.         &lt;/p&gt;

&lt;p&gt;&lt;a href="https://learn.microsoft.com/en-us/azure/storage/queues/storage-queues-introduction" rel="noopener noreferrer"&gt;https://learn.microsoft.com/en-us/azure/storage/queues/storage-queues-introduction&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Know more about other storage services in more detail.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://learn.microsoft.com/en-us/azure/storage/common/storage-introduction" rel="noopener noreferrer"&gt;https://learn.microsoft.com/en-us/azure/storage/common/storage-introduction&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In this write-up, we will learn to use azure storage to upload, view and delete files using Blazor Web Apps. We will upload and view files in Azure Storage using Blazor web app with .NET 7.&lt;/p&gt;

&lt;p&gt;Let’s commence 😊.&lt;/p&gt;

&lt;h2&gt;
  
  
  Prerequisites
&lt;/h2&gt;

&lt;p&gt;Visual Studio 2022&lt;br&gt;
.NET 7&lt;br&gt;
Azure Subscription (You can create trial subscription)&lt;br&gt;
C# Knowledge&lt;br&gt;
We will use Blazer Server with .NET 7 and Azure Blob Storage.&lt;/p&gt;
&lt;h2&gt;
  
  
  Create Azure Storage Account
&lt;/h2&gt;

&lt;p&gt;Azure storage account provides a unique namespace in the cloud for our azure storage that contains all the azure data storage components including Blob storage, Azure Files, Azure Tables, Azure Queues, and disks and can be accessible through authenticate HTTP(S) calls.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://learn.microsoft.com/en-us/azure/storage/common/storage-account-overview" rel="noopener noreferrer"&gt;https://learn.microsoft.com/en-us/azure/storage/common/storage-account-overview&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We will login to the Azure portal and search for a Storage Account.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frivlfyp3tybfhc6gqmwx.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frivlfyp3tybfhc6gqmwx.png" alt="Upload and Delete files in Azure Blob Storage" width="800" height="397"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Click &lt;strong&gt;Create&lt;/strong&gt; for Storage Account.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8bd9frmeyj3crl2zdm2e.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8bd9frmeyj3crl2zdm2e.png" alt="Upload and Delete files in Azure Blob Storage" width="800" height="218"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We provide basic inputs for the storage account. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpz1csxqfvzrv9vhzg9n2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpz1csxqfvzrv9vhzg9n2.png" alt="Upload and Delete files in Azure Blob Storage" width="800" height="763"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Choose your Subscription, Resource Group, Storage Account Name, Performance and Redundancy.&lt;/p&gt;

&lt;p&gt;You can choose the nearest region from your location. Furthermore, we will determine the premium performance block blobs, file shares, or page blobs for the storage account.&lt;/p&gt;

&lt;p&gt;Importantly, the data of the storage account is always duplicated to safeguard high availability and durability. We can decide redundancy of our choice. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2x15nek2iiosw6dq6uwh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2x15nek2iiosw6dq6uwh.png" alt="Upload and Delete files in Azure Blob Storage" width="800" height="394"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;For this article, I will go with low-cost option – Locally-redundant storage LRS.&lt;/p&gt;

&lt;p&gt;Next, we will complete the advance options as portrayed.&lt;/p&gt;

&lt;p&gt;Security Section&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fr7knl17avo079dq8w1ge.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fr7knl17avo079dq8w1ge.png" alt="Upload and Delete files in Azure Blob Storage" width="800" height="402"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Data Lake Storage Gen2&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1rw93qmrxpm1u3sgh7bc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1rw93qmrxpm1u3sgh7bc.png" alt="Upload and Delete files in Azure Blob Storage" width="800" height="146"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Blog Storage and Azure Files&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjee2yf7jxmywmklynsig.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjee2yf7jxmywmklynsig.png" alt="Upload and Delete files in Azure Blob Storage" width="800" height="558"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Next, we will move to the networking section.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F90x80uhl3tao0a3pg1bj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F90x80uhl3tao0a3pg1bj.png" alt="Upload and Delete files in Azure Blob Storage" width="800" height="901"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Similarly, we will provide the data projection settings.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F55298fy0yidl9rcza6c8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F55298fy0yidl9rcza6c8.png" alt="Upload and Delete files in Azure Blob Storage" width="800" height="605"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcoh4ft8lz75amucjq8cf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcoh4ft8lz75amucjq8cf.png" alt="Upload and Delete files in Azure Blob Storage" width="800" height="497"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Encryption section&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fj2s8wx80idj9jqobp68o.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fj2s8wx80idj9jqobp68o.png" alt="Upload and Delete files in Azure Blob Storage" width="800" height="914"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Add your tags, review, and then create the storage account.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpx052vz91sz2960yetqy.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpx052vz91sz2960yetqy.png" alt="Upload and Delete files in Azure Blob Storage" width="800" height="887"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;It will take a few seconds to create the storage account.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbs0oq058nmsi6s4ad1a4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbs0oq058nmsi6s4ad1a4.png" alt="Upload and Delete files in Azure Blob Storage" width="800" height="285"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Finally, the storage account is created as shown below.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fprri6h3gj8972ze1v1qa.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fprri6h3gj8972ze1v1qa.png" alt="Upload and Delete files in Azure Blob Storage" width="800" height="493"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Add Container
&lt;/h2&gt;

&lt;p&gt;We will a container for uploading our files. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fko5u5pokh0lvvi2zqug3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fko5u5pokh0lvvi2zqug3.png" alt="Upload and Delete files in Azure Blob Storage" width="800" height="407"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now we are ready to use this container of this Azure Storage account in Blazor Application. However, we need access keys or connection strings to upload files, which can be Azure Blade Access Keys as shown below.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fm5p3eoy4guu4frste1sv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fm5p3eoy4guu4frste1sv.png" alt="Upload and Delete files in Azure Blob Storage" width="800" height="463"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  .NET 7 SDK
&lt;/h2&gt;

&lt;p&gt;We can use any version of Visual Studio 2022, and we can download from this link. You can use the community version, which is free. Additionally, you can download .NET 7 SDK for free from this official site. In my case, I am using Visual Studio 2022 Professional, however, the steps and interfaces are the same for other versions.&lt;/p&gt;

&lt;p&gt;Let’s commence.&lt;/p&gt;

&lt;p&gt;We will start with the installation .NET 7 SDK for Windows. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxcm57gb9zifsl6fxry6z.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxcm57gb9zifsl6fxry6z.png" alt="Upload and Delete files in Azure Blob Storage" width="800" height="584"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Create a Web App with Blazor Server
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Blazor server&lt;/strong&gt; runs as an implementation of server side as a part of ASP.NET core app where UI events, button clicks, UI updates and interactions are communicated over SignalR connection. In this approach, the UI is generated on a web server and is transmitted to the visitor’s browser upon request. This two-way interaction occurs using SignalR and a web sockets connection. Any change in DOM content is generated from web server and update in automatically via SignalR with Blazor Server framework. This Blazor type has direct access to server and network resources since app is executed in server side. Let’s open a Visual Studio and create a new project. We will use the Blazor Server App project template.&lt;/p&gt;

&lt;p&gt;To know more about Blazor Web Development, &lt;a href="https://rijsat.com/2022/11/07/what-is-blazor-web-development/" rel="noopener noreferrer"&gt;click here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;To learn to develop a Blazor Application, &lt;a href="https://rijsat.com/2022/11/15/develop-a-web-app-with-blazor-in-net-7/" rel="noopener noreferrer"&gt;click here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fd1eeiznc848wzl0bs706.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fd1eeiznc848wzl0bs706.png" alt="Upload and Delete files in Azure Blob Storage" width="800" height="535"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We will provide a project name and location for the solution.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkngk5kpwor3wx24palev.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkngk5kpwor3wx24palev.png" alt="Upload and Delete files in Azure Blob Storage" width="800" height="534"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;​On the next screen, we will get options to choose .Net framework, Authentication type and a couple options for the project.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3f86x7vaaaag9zcifaze.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3f86x7vaaaag9zcifaze.png" alt="Upload and Delete files in Azure Blob Storage" width="800" height="529"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After installation of .NET 7 SDK, we will have an option to choose .NET 7 in the framework. We will select the .NET 7 framework and proceed. To keep it simple, we will keep other options default.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftble1hq9py55wx2j3p8e.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftble1hq9py55wx2j3p8e.png" alt="Upload and Delete files in Azure Blob Storage" width="800" height="423"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We have successfully created a Blazor server web application with .NET 7. We will build and run the solution.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fm6l0ar4v83quzl70m14j.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fm6l0ar4v83quzl70m14j.png" alt="Upload and Delete files in Azure Blob Storage" width="800" height="381"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This is how we can create a Blazor server app.&lt;/p&gt;
&lt;h2&gt;
  
  
  Upload and Delete Files in Azure Blob Storage Using Blazor App with .NET 7
&lt;/h2&gt;

&lt;p&gt;In this section, I will write a complete project to upload and delete files in Azure Blob Storage using Blazor app in the above solution.&lt;/p&gt;

&lt;p&gt;Firstly, we will a NuGet package named Azure.Storage.Blobs as shown below.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fowzmio9dpc3jx7hntxui.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fowzmio9dpc3jx7hntxui.png" alt="Upload and Delete files in Azure Blob Storage" width="800" height="453"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We will begin by creating a service class for Azure Blob Storage under a folder name Services. We will add an IBlobStorageService named interface class as shown. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fr8xwlemautw4xyv92u0n.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fr8xwlemautw4xyv92u0n.png" alt="Upload and Delete files in Azure Blob Storage" width="800" height="384"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Define an upload and delete method of the file as shown below.&lt;/p&gt;

&lt;p&gt;Code for IBlobStorageService.cs&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;namespace RijsatFileUploadAzureStorage.Services;
public interface IBlobStorageService
{
    Task&amp;lt;string&amp;gt; UploadFileToBlobAsync(string strFileName, string contecntType, Stream fileStream);
    Task&amp;lt;bool&amp;gt; DeleteFileToBlobAsync(string strFileName);
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Again, add a BlobStorageService named implementation class for the above interface under the same services folder.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyis0tmiaf9vln5fjsbu1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyis0tmiaf9vln5fjsbu1.png" alt="Upload and Delete files in Azure Blob Storage" width="800" height="432"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The structure will be as shown below.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpkmn846f548lz47ep9rn.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpkmn846f548lz47ep9rn.png" alt="Upload and Delete files in Azure Blob Storage" width="800" height="274"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Add a constructor and inject application Configuration.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F57ntquwc8elhp7hij3t2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F57ntquwc8elhp7hij3t2.png" alt="Upload and Delete files in Azure Blob Storage" width="800" height="339"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Code&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;private readonly IConfiguration _configuration;
private readonly ILogger&amp;lt;BlobStorageService&amp;gt; _logger;
public BlobStorageService(IConfiguration configuration, ILogger&amp;lt;BlobStorageService&amp;gt; logger)
{
        _configuration = configuration;   
        _logger = logger;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We will add the connection sting of Storage account into appsetting.json as shown below:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fveoiip35ggpj9jgtu9x9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fveoiip35ggpj9jgtu9x9.png" alt="Upload and Delete files in Azure Blob Storage" width="800" height="243"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Likewise, we use this connection string in our BlobStorageService service class.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fstdau2mh00tr00a76xs5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fstdau2mh00tr00a76xs5.png" alt="Upload and Delete files in Azure Blob Storage" width="800" height="381"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We will also define our container for this blob storage. Our container name is rijsatdemo which we created during the storage account.&lt;/p&gt;

&lt;p&gt;Function for File Upload&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F28cdrue0yt4qfh4h56wt.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F28cdrue0yt4qfh4h56wt.png" alt="Upload and Delete files in Azure Blob Storage" width="800" height="552"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Please the references as shown.&lt;/p&gt;

&lt;p&gt;Code for Upload Function&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;public async Task&amp;lt;string&amp;gt; UploadFileToBlobAsync(string strFileName, string contecntType, Stream fileStream)
    {
        try
        {
            var container = new BlobContainerClient(blobStorageconnection, blobContainerName);
            var createResponse = await container.CreateIfNotExistsAsync();
            if (createResponse != null &amp;amp;&amp;amp; createResponse.GetRawResponse().Status == 201)
                await container.SetAccessPolicyAsync(Azure.Storage.Blobs.Models.PublicAccessType.Blob);
            var blob = container.GetBlobClient(strFileName);
            await blob.DeleteIfExistsAsync(DeleteSnapshotsOption.IncludeSnapshots);
            await blob.UploadAsync(fileStream, new BlobHttpHeaders { ContentType = contecntType });
            var urlString = blob.Uri.ToString();
            return urlString;
        }
        catch (Exception ex)
        {
            _logger?.LogError(ex.ToString());
            throw;
        }
    }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Similarly, the code for deleting file method.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;public async Task&amp;lt;bool&amp;gt; DeleteFileToBlobAsync(string strFileName)
    {
        try
        {
            var container = new BlobContainerClient(blobStorageconnection, blobContainerName);
            var createResponse = await container.CreateIfNotExistsAsync();
            if (createResponse != null &amp;amp;&amp;amp; createResponse.GetRawResponse().Status == 201)
                await container.SetAccessPolicyAsync(Azure.Storage.Blobs.Models.PublicAccessType.Blob);
            var blob = container.GetBlobClient(strFileName);
            await blob.DeleteIfExistsAsync(DeleteSnapshotsOption.IncludeSnapshots);
            return true;
        }
        catch (Exception ex )
        {
            _logger?.LogError(ex.ToString());
            throw;
        }
    }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Overall, the BlobStorageService class be as shown below.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;using Azure.Storage.Blobs;
using Azure.Storage.Blobs.Models;
using Microsoft.Extensions.Logging;
using System.Reflection.Metadata.Ecma335;

namespace RijsatFileUploadAzureStorage.Services;
public class BlobStorageService : IBlobStorageService
{
    private readonly IConfiguration _configuration;
    private readonly ILogger&amp;lt;BlobStorageService&amp;gt; _logger;
    string blobStorageconnection = string.Empty;
    private string blobContainerName = "rijsatdemo";
    public BlobStorageService(IConfiguration configuration, ILogger&amp;lt;BlobStorageService&amp;gt; logger)
    {
        _configuration = configuration;   
        _logger = logger;
        blobStorageconnection = _configuration.GetConnectionString("AzureStorageAccount");
    }
    public async Task&amp;lt;string&amp;gt; UploadFileToBlobAsync(string strFileName, string contecntType, Stream fileStream)
    {
        try
        {
            var container = new BlobContainerClient(blobStorageconnection, blobContainerName);
            var createResponse = await container.CreateIfNotExistsAsync();
            if (createResponse != null &amp;amp;&amp;amp; createResponse.GetRawResponse().Status == 201)
                await container.SetAccessPolicyAsync(Azure.Storage.Blobs.Models.PublicAccessType.Blob);
            var blob = container.GetBlobClient(strFileName);
            await blob.DeleteIfExistsAsync(DeleteSnapshotsOption.IncludeSnapshots);
            await blob.UploadAsync(fileStream, new BlobHttpHeaders { ContentType = contecntType });
            var urlString = blob.Uri.ToString();
            return urlString;
        }
        catch (Exception ex)
        {
            _logger?.LogError(ex.ToString());
            throw;
        }
    }
    public async Task&amp;lt;bool&amp;gt; DeleteFileToBlobAsync(string strFileName)
    {
        try
        {
            var container = new BlobContainerClient(blobStorageconnection, blobContainerName);
            var createResponse = await container.CreateIfNotExistsAsync();
            if (createResponse != null &amp;amp;&amp;amp; createResponse.GetRawResponse().Status == 201)
                await container.SetAccessPolicyAsync(Azure.Storage.Blobs.Models.PublicAccessType.Blob);
            var blob = container.GetBlobClient(strFileName);
            await blob.DeleteIfExistsAsync(DeleteSnapshotsOption.IncludeSnapshots);
            return true;
        }
        catch (Exception ex )
        {
            _logger?.LogError(ex.ToString());
            throw;
        }
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We will add a dependency injection service to the container in the program.cs file.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbyuugdzjcsrga34lhoiu.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbyuugdzjcsrga34lhoiu.png" alt="Upload and Delete files in Azure Blob Storage" width="800" height="572"&gt;&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;builder.Services.AddScoped&amp;lt;IBlobStorageService, BlobStorageService&amp;gt;();
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Add a view model or Data transfer object of file upload into services folder as shown.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3e6q7cqvrypaxsrn9p33.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3e6q7cqvrypaxsrn9p33.png" alt="Upload and Delete files in Azure Blob Storage" width="800" height="310"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Code for the FileUploadViewModel.cs&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;namespace RijsatFileUploadAzureStorage.Services.Dto
{
    public class FileUploadViewModel
    {
        public string FileName { get; set; }
        public string FileStorageUrl { get; set; }
        public string ContentType { get; set; }
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now we will move to the Blazor Component for the uploading section in the Index.razor component file.&lt;/p&gt;

&lt;p&gt;Add a file upload section into Index component. Replace Index with below code.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;h4&amp;gt;File Upload (Azure Blob Storage)&amp;lt;/h4&amp;gt;
&amp;lt;div class="row"&amp;gt;
    &amp;lt;div class="col-sm-6"&amp;gt;
        &amp;lt;label&amp;gt;
            &amp;lt;InputFile class="form-control" disabled="@fileLoading" OnChange="@OnInputFileChange" single /&amp;gt;
        &amp;lt;/label&amp;gt;
        @if (fileLoading)
        {
            &amp;lt;i class="fa fa-refresh"&amp;gt;&amp;lt;/i&amp;gt; &amp;lt;span&amp;gt;Loading...&amp;lt;/span&amp;gt;
        }
    &amp;lt;/div&amp;gt;
    &amp;lt;div class="col-sm-2"&amp;gt;
        &amp;lt;button type="button" disabled="@fileLoading" class="btn btn-primary" @onclick="OnUploadSubmit"&amp;gt;
            Upload File
        &amp;lt;/button&amp;gt;
    &amp;lt;/div&amp;gt;
&amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then, I will add a table to show the list of uploaded files.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;div class="row"&amp;gt;
    @if (fileUploadViewModels.Count &amp;gt; 0)
    {
        &amp;lt;table class="table table-responsive table-bordered"&amp;gt;
            &amp;lt;thead class="text-primary"&amp;gt;
                &amp;lt;tr&amp;gt;
                    &amp;lt;th&amp;gt;File&amp;lt;/th&amp;gt;
                    &amp;lt;th&amp;gt;Action&amp;lt;/th&amp;gt;
                &amp;lt;/tr&amp;gt;
            &amp;lt;/thead&amp;gt;
            &amp;lt;tbody&amp;gt;
                @foreach (var attachment in fileUploadViewModels)
                {

                    &amp;lt;tr&amp;gt;
                        &amp;lt;td&amp;gt;
                            &amp;lt;a class="text-primary"&amp;gt;&amp;lt;i class="fa-solid fa-paperclip"&amp;gt;&amp;lt;/i&amp;gt; @attachment.FileName&amp;lt;/a&amp;gt;
                        &amp;lt;/td&amp;gt;                      

                            &amp;lt;td&amp;gt;
                            &amp;lt;span class="oi oi-delete" aria-hidden="true" @onclick="() =&amp;gt; OnFileDeleteClick(attachment)"&amp;gt;&amp;lt;/span&amp;gt;
                            &amp;lt;/td&amp;gt;
                    &amp;lt;/tr&amp;gt;
                }
            &amp;lt;/tbody&amp;gt;
        &amp;lt;/table&amp;gt;
    }
    else
    {
        &amp;lt;div class="alert alert-info"&amp;gt;
            &amp;lt;strong&amp;gt;No Files!&amp;lt;/strong&amp;gt;
        &amp;lt;/div&amp;gt;
    }
&amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We will add the code part for uploading and deleting in index.razor component.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;@code {
    private string warninngMessage = "";
    private string displayMessage = "";
    private List&amp;lt;IBrowserFile&amp;gt; loadedFiles = new();
    private long maxFileSize = 1024 * 15;
    private int maxAllowedFiles = 3;
    private bool fileLoading;
    string Message = "No file(s) selected";
    IReadOnlyList&amp;lt;IBrowserFile&amp;gt; selectedFiles;
    private List&amp;lt;FileUploadViewModel&amp;gt; fileUploadViewModels = new();
    private void OnInputFileChange(InputFileChangeEventArgs e)
    {
        selectedFiles = e.GetMultipleFiles();
        Message = $"{selectedFiles.Count} file(s) selected";
        this.StateHasChanged();
    }
    private async void OnUploadSubmit()
    {
        fileLoading = true;
        foreach (var file in selectedFiles)
        {
            try
            {
                var trustedFileNameForFileStorage = file.Name;
                var blobUrl = await blobStorageService.UploadFileToBlobAsync(trustedFileNameForFileStorage, file.ContentType, file.OpenReadStream(20971520));
                if (blobUrl != null)
                {
                    FileUploadViewModel fileUploadViewModel = new FileUploadViewModel()
                        {
                            FileName = trustedFileNameForFileStorage,
                            FileStorageUrl = blobUrl,
                            ContentType = file.ContentType,
                        };

                    fileUploadViewModels.Add(fileUploadViewModel);
                    displayMessage = trustedFileNameForFileStorage + " Uploaded!!";
                }
                else
                    warninngMessage = "File Upload failed, Please try again!!";

            }
            catch (Exception ex)
            {
                warninngMessage = "File Upload failed, Please try again!!";
            }
        }

        fileLoading = false;
        this.StateHasChanged();
    }

    private async void OnFileDeleteClick(FileUploadViewModel attachment)
    {
        try
        {
            var deleteResponse = await blobStorageService.DeleteFileToBlobAsync(attachment.FileName);
            if (deleteResponse)
            {
                fileUploadViewModels.Remove(attachment);
                displayMessage = attachment.FileName + " Deleted!!";
            }

        }
        catch (Exception)
        {
            warninngMessage = "Something went wrong! Please try again.";
        }
        this.StateHasChanged();
    }

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

&lt;/div&gt;



&lt;p&gt;In the above code, we have &lt;strong&gt;&lt;em&gt;OnUploadSubmit(&lt;/em&gt;&lt;/strong&gt;) and &lt;strong&gt;&lt;em&gt;OnFileDeleteClick()&lt;/em&gt;&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Complete &lt;strong&gt;&lt;em&gt;Index.razor&lt;/em&gt;&lt;/strong&gt; component code.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;@page "/"
@using RijsatFileUploadAzureStorage.Services;
@using RijsatFileUploadAzureStorage.Services.Dto;
@inject IBlobStorageService blobStorageService

&amp;lt;PageTitle&amp;gt;Index&amp;lt;/PageTitle&amp;gt;
@if (warninngMessage.Length &amp;gt; 0)
{
    &amp;lt;div class="alert alert-warning"&amp;gt;
        &amp;lt;strong&amp;gt;Warning!&amp;lt;/strong&amp;gt; @warninngMessage.
    &amp;lt;/div&amp;gt;
}

&amp;lt;h4&amp;gt;File Upload (Azure Blob Storage)&amp;lt;/h4&amp;gt;
&amp;lt;div class="row"&amp;gt;
    &amp;lt;div class="col-sm-6"&amp;gt;
        &amp;lt;label&amp;gt;
            &amp;lt;InputFile class="form-control" disabled="@fileLoading" OnChange="@OnInputFileChange" single /&amp;gt;
        &amp;lt;/label&amp;gt;
        @if (fileLoading)
        {
            &amp;lt;i class="fa fa-refresh"&amp;gt;&amp;lt;/i&amp;gt; &amp;lt;span&amp;gt;Loading...&amp;lt;/span&amp;gt;
        }
    &amp;lt;/div&amp;gt;
    &amp;lt;div class="col-sm-2"&amp;gt;
        &amp;lt;button type="button" disabled="@fileLoading" class="btn btn-primary" @onclick="OnUploadSubmit"&amp;gt;
            Upload File
        &amp;lt;/button&amp;gt;
    &amp;lt;/div&amp;gt;
&amp;lt;/div&amp;gt;
@if (displayMessage.Length &amp;gt; 0)
{
    &amp;lt;div class="alert alert-success"&amp;gt;
        &amp;lt;strong&amp;gt;Success!&amp;lt;/strong&amp;gt; @displayMessage.
    &amp;lt;/div&amp;gt;
}
&amp;lt;br /&amp;gt;
&amp;lt;div class="row"&amp;gt;
    @if (fileUploadViewModels.Count &amp;gt; 0)
    {
        &amp;lt;table class="table table-responsive table-bordered"&amp;gt;
            &amp;lt;thead class="text-primary"&amp;gt;
                &amp;lt;tr&amp;gt;
                    &amp;lt;th&amp;gt;File&amp;lt;/th&amp;gt;
                    &amp;lt;th&amp;gt;Action&amp;lt;/th&amp;gt;
                &amp;lt;/tr&amp;gt;
            &amp;lt;/thead&amp;gt;
            &amp;lt;tbody&amp;gt;
                @foreach (var attachment in fileUploadViewModels)
                {

                    &amp;lt;tr&amp;gt;
                        &amp;lt;td&amp;gt;
                            &amp;lt;a class="text-primary"&amp;gt;&amp;lt;i class="fa-solid fa-paperclip"&amp;gt;&amp;lt;/i&amp;gt; @attachment.FileName&amp;lt;/a&amp;gt;
                        &amp;lt;/td&amp;gt;                      

                            &amp;lt;td&amp;gt;
                            &amp;lt;span class="oi oi-delete" aria-hidden="true" @onclick="() =&amp;gt; OnFileDeleteClick(attachment)"&amp;gt;&amp;lt;/span&amp;gt;
                            &amp;lt;/td&amp;gt;
                    &amp;lt;/tr&amp;gt;
                }
            &amp;lt;/tbody&amp;gt;
        &amp;lt;/table&amp;gt;
    }
    else
    {
        &amp;lt;div class="alert alert-info"&amp;gt;
            &amp;lt;strong&amp;gt;No Files!&amp;lt;/strong&amp;gt;
        &amp;lt;/div&amp;gt;
    }
&amp;lt;/div&amp;gt;

@code {
    private string warninngMessage = "";
    private string displayMessage = "";
    private List&amp;lt;IBrowserFile&amp;gt; loadedFiles = new();
    private long maxFileSize = 1024 * 15;
    private int maxAllowedFiles = 3;
    private bool fileLoading;
    string Message = "No file(s) selected";
    IReadOnlyList&amp;lt;IBrowserFile&amp;gt; selectedFiles;
    private List&amp;lt;FileUploadViewModel&amp;gt; fileUploadViewModels = new();
    private void OnInputFileChange(InputFileChangeEventArgs e)
    {
        selectedFiles = e.GetMultipleFiles();
        Message = $"{selectedFiles.Count} file(s) selected";
        this.StateHasChanged();
    }
    private async void OnUploadSubmit()
    {
        fileLoading = true;
        foreach (var file in selectedFiles)
        {
            try
            {
                var trustedFileNameForFileStorage = file.Name;
                var blobUrl = await blobStorageService.UploadFileToBlobAsync(trustedFileNameForFileStorage, file.ContentType, file.OpenReadStream(20971520));
                if (blobUrl != null)
                {
                    FileUploadViewModel fileUploadViewModel = new FileUploadViewModel()
                        {
                            FileName = trustedFileNameForFileStorage,
                            FileStorageUrl = blobUrl,
                            ContentType = file.ContentType,
                        };

                    fileUploadViewModels.Add(fileUploadViewModel);
                    displayMessage = trustedFileNameForFileStorage + " Uploaded!!";
                }
                else
                    warninngMessage = "File Upload failed, Please try again!!";

            }
            catch (Exception ex)
            {
                warninngMessage = "File Upload failed, Please try again!!";
            }
        }

        fileLoading = false;
        this.StateHasChanged();
    }

    private async void OnFileDeleteClick(FileUploadViewModel attachment)
    {
        try
        {
            var deleteResponse = await blobStorageService.DeleteFileToBlobAsync(attachment.FileName);
            if (deleteResponse)
            {
                fileUploadViewModels.Remove(attachment);
                displayMessage = attachment.FileName + " Deleted!!";
            }

        }
        catch (Exception)
        {
            warninngMessage = "Something went wrong! Please try again.";
        }
        this.StateHasChanged();
    }

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

&lt;/div&gt;



&lt;p&gt;Let’s build and run the solution.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjnju1f4g7mifdxgjvxfu.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjnju1f4g7mifdxgjvxfu.png" alt="Upload and Delete files in Azure Blob Storage" width="800" height="228"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Uploading File into the Azure Blob Storage.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fx5xiynez7ofzpi3n7vb2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fx5xiynez7ofzpi3n7vb2.png" alt="Upload and Delete files in Azure Blob Storage" width="800" height="182"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Let me show the uploaded file into Azure Blob from Azure Portal.&lt;/p&gt;

&lt;p&gt;Go to the container and open it (rijsatdemo).&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frq1qg2r2x8amereqdety.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frq1qg2r2x8amereqdety.png" alt="Upload and Delete files in Azure Blob Storage" width="800" height="256"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We can see the file in the Azure Blob container. We have successfully uploaded the file into Azure Blob Storage using the Blazor Server with .NET 7.&lt;/p&gt;

&lt;p&gt;Likewise, we can delete the file using above the code as demonstrated.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3makmv7k2vuyahlbe3b5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3makmv7k2vuyahlbe3b5.png" alt="Upload and Delete files in Azure Blob Storage" width="800" height="219"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This is how we can upload and delete files in Azure Blob Storage from a Blazor App with .NET 7.&lt;/p&gt;

&lt;p&gt;You can find a complete Solution on GitHub, &lt;a href="https://github.com/rijwanansari/RijsatFileUploadAzureStorage" rel="noopener noreferrer"&gt;Click Here&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;In this article, I have done a complete solution to upload and delete files in Azure Blob Storage from Blazor Application with .NET 7. Furthermore, I have demonstrated how to create an Azure Storage Account and a container for uploading files and documents. Then again, I have built a Blazor Server web application with .NET 7. At last, I did a complete solution to upload and delete files in Azure Blob Storage with code and showed an example. &lt;br&gt;
Reference:&lt;br&gt;
&lt;a href="https://rijsat.com/2023/01/11/upload-and-delete-files-in-azure-blob-storage-using-blazor-apps-with-net-7/" rel="noopener noreferrer"&gt;https://rijsat.com/2023/01/11/upload-and-delete-files-in-azure-blob-storage-using-blazor-apps-with-net-7/&lt;/a&gt;&lt;/p&gt;

</description>
      <category>gratitude</category>
      <category>braziliandevs</category>
    </item>
    <item>
      <title>How to Build A Web App With Blazor In .NET 7</title>
      <dc:creator>Rijwan Ansari</dc:creator>
      <pubDate>Wed, 23 Nov 2022 06:16:13 +0000</pubDate>
      <link>https://dev.to/rijwanansari/how-to-build-a-web-app-with-blazor-in-net-7-8g8</link>
      <guid>https://dev.to/rijwanansari/how-to-build-a-web-app-with-blazor-in-net-7-8g8</guid>
      <description>&lt;p&gt;There are a wide range of platforms and technologies for web development, which creates uncertainty to find the best one based on the developer skills setup. Considering the latest web apps development trends, we split the development into two segments: Front-End and Back-End development. Based on the above two development parts, web apps development requires 2 major roles for developers, and those are Front-End and Back-End developers. Subsequently, the web apps development necessitates various skills on both the front-end and backend side to build a complete system. Furthermore, there are several front-end frameworks, popularly, Angular, Reack.Js, Vue.js, JavaScript which again requires different skill sets and developers. However, the most popular choice for backend development, server-side logic is C# and .NET. This creates a complex scenario to build Web UI with front-end technologies and then again server-side logic with back-end technologies.&lt;br&gt;
However, Blazor framework is one of the web development platforms for the .Net family that provides the flexibility to develop both backend and front using the same language, C#. It is a component-driven UI framework that takes advantage of shared business objects and code for building applications in both front-end and back-end.&lt;/p&gt;

&lt;p&gt;In this article, we will develop a web app with Blazor in .NET 7. Furthermore, we will check both Blazor Server and Blazor WebAssembly with default project structure.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;What is Blazor?&lt;/li&gt;
&lt;li&gt;.NET 7 Generally Available&lt;/li&gt;
&lt;li&gt;What is Blazor Server?&lt;/li&gt;
&lt;li&gt;What is Blazer WebAssembly?&lt;/li&gt;
&lt;li&gt;Build a web app with Blazor Server with .NET 7&lt;/li&gt;
&lt;li&gt;Build a web app with Blazor WebAssembly with .NET 7&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you want to know more about web development with Blazor, please check my previous article &lt;a href="https://rijsat.com/2022/11/07/what-is-blazor-web-development/" rel="noopener noreferrer"&gt;Web Development with Blazor&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is Blazor?
&lt;/h2&gt;

&lt;p&gt;Blazor is one of the frameworks for the .Net family for web development. Specifically, it is a user-interface framework for .Net applications, which utilizes the same C# language from front-end development. Additionally, it is a component-driven UI framework that provides flexibility to use shared business objects and code for front-end and backend development. Therefore, it enables the .Net developer with the same C# skill to build complete applications. Because of which, this Blazor framework makes the .Net ecosystem more sustainable and efficient.&lt;br&gt;
In simple team, Blazor is a new client-side framework to ASP.NET for developing UI for web using C# instead of JavaScript, which allows running in the browser using web Assemble. It is a combination of the words Browser and Razor, i.e., Blazor.&lt;br&gt;
Let’s commence with building a web application with Blazor server and WebAssembly with .NET 7.&lt;/p&gt;

&lt;h2&gt;
  
  
  .NET 7
&lt;/h2&gt;

&lt;p&gt;I am happy to say that .NET 7 is generally available. It is officially released on 8 November 2022. Newly released .NET 7 comes with huge improvement in performance and several new features. We can &lt;a href="https://dotnet.microsoft.com/en-us/download/dotnet/7.0" rel="noopener noreferrer"&gt;download .NET 7 for free from this authorized site&lt;/a&gt; for windows, macOS and Linux. .NET 7 is so flexible and versatile that we can develop any kind of application on any platform.&lt;/p&gt;

&lt;h2&gt;
  
  
  Prerequisites
&lt;/h2&gt;

&lt;p&gt;Before jumping into Blazor applications, we need the following perquisites.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Visual Studio 2022 (or Visual Studio Code)&lt;/li&gt;
&lt;li&gt;.NET 7 SDK&lt;/li&gt;
&lt;li&gt;C# knowledge
We can use any version of Visual Studio 2022, and we can download from this link. You can use the community version, which is free. Additionally, you can download .NET 7 SDK for free from this official site. In my case, I am using Visual Studio 2022 Professional, however, the steps and interfaces are the same for other versions.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Let’s commence.&lt;/p&gt;

&lt;p&gt;We will start with the installation .NET 7 SDK for Windows.&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%2Fuploads%2Farticles%2Fq5ku4z87o4g6ky3f5mqk.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%2Fuploads%2Farticles%2Fq5ku4z87o4g6ky3f5mqk.png" alt="Web App With Blazor In .NET 7"&gt;&lt;/a&gt; &lt;/p&gt;

&lt;h2&gt;
  
  
  Blazor Server
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Blazor server&lt;/strong&gt; runs as an implementation of server side as a part of ASP.NET core app where UI events, button clicks, UI updates and interactions are communicated over SignalR connection. In this approach, the UI is generated on a web server and is transmitted to the visitor’s browser upon request. This two-way interaction occurs using SignalR and a web sockets connection. Any change in DOM content is generated from web server and update in automatically via SignalR with Blazor Server framework. This Blazor type has direct access to server and network resources since app is executed in server side.&lt;/p&gt;

&lt;h2&gt;
  
  
  Build a Web App with Blazor Server
&lt;/h2&gt;

&lt;p&gt;In this section, we will create a web application with Blazor Server template step by step. &lt;/p&gt;

&lt;p&gt;We will open Visual Studio and create a new project as shown:&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%2Fuploads%2Farticles%2Fhv36rz3rxquk2o5dk04t.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%2Fuploads%2Farticles%2Fhv36rz3rxquk2o5dk04t.png" alt="Web App With Blazor In .NET 7"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;To develop Blazor server application, we will choose Blazor server app template and proceed to next. We will give a project name and location.&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%2Fuploads%2Farticles%2Flubpwwu82w0sghmd86p6.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%2Fuploads%2Farticles%2Flubpwwu82w0sghmd86p6.png" alt="Web App With Blazor In .NET 7"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In the next screen, we will get an option to choose .Net framework, Authentication type and a couple options for the project.&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%2Fuploads%2Farticles%2Frlbm9gvz31mrq69ma16t.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%2Fuploads%2Farticles%2Frlbm9gvz31mrq69ma16t.png" alt="Web App With Blazor In .NET 7"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After installation of .NET 7 SDK, we will have an option to choose .NET 7 in the framework. We will select .NET 7 framework and proceed. To keep it simple, we will keep other options default.&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%2Fuploads%2Farticles%2Fw0mfupxshrrtdm8ttpji.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%2Fuploads%2Farticles%2Fw0mfupxshrrtdm8ttpji.png" alt="Web App With Blazor In .NET 7"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We have successfully created a Blazor server web application, and the project structure as shown.&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%2Fuploads%2Farticles%2F5nsja215xl4z9sw6o7st.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%2Fuploads%2Farticles%2F5nsja215xl4z9sw6o7st.png" alt="Web App With Blazor In .NET 7"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Furthermore, if we check FetchData.rozor page/component, we can call the services, business logic classes directly from Blazor page and use application models.&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%2Fuploads%2Farticles%2F1bgx5slfz6hmpnuxb4um.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%2Fuploads%2Farticles%2F1bgx5slfz6hmpnuxb4um.png" alt="Web App With Blazor In .NET 7"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This is how we can use server-side code in Blazor server. We have full access to the server side from the Blazor page and can interact with data or databases.&lt;/p&gt;

&lt;p&gt;Let’s build and run the solution. &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%2Fuploads%2Farticles%2Fd8jj2lhr5htv7lhjya2v.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%2Fuploads%2Farticles%2Fd8jj2lhr5htv7lhjya2v.png" alt="Web App With Blazor In .NET 7"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now I will add a logic in the counter component. &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%2Fuploads%2Farticles%2Fsao0u5n9bm1zvxin6t33.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%2Fuploads%2Farticles%2Fsao0u5n9bm1zvxin6t33.png" alt="Web App With Blazor In .NET 7"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We will build and run the solution again.&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%2Fuploads%2Farticles%2F2l8bzi8mf68lg7201jo5.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%2Fuploads%2Farticles%2F2l8bzi8mf68lg7201jo5.png" alt="Web App With Blazor In .NET 7"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This is how we can develop a Blazor server app.&lt;/p&gt;

&lt;p&gt;Now let’s move to Blazor WebAssembly.&lt;/p&gt;

&lt;h2&gt;
  
  
  Build a Web App with Blazor WebAssembly
&lt;/h2&gt;

&lt;p&gt;Blazor WebAssembly, on the other hand, runs on the user’s browser as a client application by loading application dependencies, and .NET runtime to the browser. In this approach, we can publish the Blazor applications as static files without the requirement of a web server or its interactions, since WebAssembly is a technology that executes entirely in the client browser. Although we can do advanced logic in client side using C# in the browser, however, to interact with data, database or other services, this type uses standard web technologies HTTP services.&lt;/p&gt;

&lt;p&gt;Again, we will open Visual Studio and create a new project. Then, this time, we will choose the Blazor WebAssembly App project template as portrayed. &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%2Fuploads%2Farticles%2Fqzly6f70pfzejpv598fv.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%2Fuploads%2Farticles%2Fqzly6f70pfzejpv598fv.png" alt="Web App With Blazor In .NET 7"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Again, we will give a name and location of the Project.&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%2Fuploads%2Farticles%2Fz9bt58ws1n41yl3u5a2z.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%2Fuploads%2Farticles%2Fz9bt58ws1n41yl3u5a2z.png" alt="Web App With Blazor In .NET 7"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In the next screen, we will choose .NET framework 7, authentication type as none for this article, and there are some more options as illustrated. &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%2Fuploads%2Farticles%2Fwy8rxzx6jb2hwmyqa8yx.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%2Fuploads%2Farticles%2Fwy8rxzx6jb2hwmyqa8yx.png" alt="Web App With Blazor In .NET 7"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Let’s discuss those options.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;ASP.NET Core Hosted&lt;/strong&gt; – this option will create a project and asp.net core hosted environment for Blazor WebAssembly project. Which means, we can deploy and host the application as like asp.net core.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Progressive Web Application&lt;/strong&gt; – This option produces a Progressive Web Assembly supporting installation, and offline use.&lt;/p&gt;

&lt;p&gt;For this article, we will choose ASP.NET core hosted and proceed.  &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%2Fuploads%2Farticles%2F2nw7xw6sm4qazzhiqpzm.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%2Fuploads%2Farticles%2F2nw7xw6sm4qazzhiqpzm.png" alt="Web App With Blazor In .NET 7"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We have successfully created a Blazor WebAssembly project in .NET 7. In this project template, we have 3 projects by default.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Client Project&lt;/strong&gt; – This project contains the Blazor components, client-side logics with C#. However, we don’t write any services or server-side logic in this project. We do interaction with data or databases via HTTP services.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Server Project&lt;/strong&gt; – This is like a general asp.net web API project. Here, we do server-side logic, build APIs for the client application. We create services, Database interaction, infra and networks and so on. We can follow any solution design and pattern based on our needs.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Shared Project&lt;/strong&gt; – This project adds advantages to the Blazor client project. We use this project to write shared models, objects, or data transfer objects. We can reuse those components for both server and client projects.&lt;/p&gt;

&lt;p&gt;Let’s check the Client project. &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%2Fuploads%2Farticles%2F29ul3xczk524wc2zjkvb.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%2Fuploads%2Farticles%2F29ul3xczk524wc2zjkvb.png" alt="Web App With Blazor In .NET 7"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If we observe then, this project is using a shared model and getting data through http call. However, we can write client-side logic with C#. &lt;/p&gt;

&lt;p&gt;Then again, if we check the server project, which is more like a normal web API. However, the reference of Client project is added. &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%2Fuploads%2Farticles%2Fp2pbo7scrn4ck8zd3ilw.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%2Fuploads%2Farticles%2Fp2pbo7scrn4ck8zd3ilw.png" alt="Web App With Blazor In .NET 7"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The client project is referenced here because this will be hosted in IIS. During the project creation, we choose the option ASP.NET core hosted. Simply, we can deploy this project to have both client and server.&lt;/p&gt;

&lt;p&gt;Now, we will build and run the solution. &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%2Fuploads%2Farticles%2F33mey9l099ssncduh321.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%2Fuploads%2Farticles%2F33mey9l099ssncduh321.png" alt="Web App With Blazor In .NET 7"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This is how we can develop a Blazor WebAssembly application.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;In this write-up, we learned about Blazor web development. Furthermore, I have elucidated about Blazor development options for various scenarios with examples. Based on hosting decisions, we can choose Blazor server or Blazor WebAssembly to deploy as an ASP.NET core or as a WASM. Additionally, I have illustrated how to build a web application with both Blazor server and Blazor WebAssembly. This article will also assist you to know the difference between Blazor server and WebAssembly and their project structures.&lt;/p&gt;

&lt;p&gt;References:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://rijsat.com/2022/11/15/develop-a-web-app-with-blazor-in-net-7/" rel="noopener noreferrer"&gt;Develop A Web App with Blazor (rijsat.com)&lt;/a&gt;&lt;br&gt;
&lt;a href="https://learn.microsoft.com/en-us/training/paths/build-web-apps-with-blazor/" rel="noopener noreferrer"&gt;Microsoft Learn&lt;/a&gt;&lt;/p&gt;

</description>
      <category>dotnet</category>
      <category>blazor</category>
      <category>webdev</category>
    </item>
    <item>
      <title>What is Blazor Web Development?</title>
      <dc:creator>Rijwan Ansari</dc:creator>
      <pubDate>Tue, 08 Nov 2022 08:43:19 +0000</pubDate>
      <link>https://dev.to/rijwanansari/what-is-blazor-web-development-4afo</link>
      <guid>https://dev.to/rijwanansari/what-is-blazor-web-development-4afo</guid>
      <description>&lt;p&gt;The complexity of web development is increasing in the contemporary world because of several technologies and tools. There are a wide range of platforms and technologies for web development, which creates uncertainty to find the best one based on the developer skills setup. Considering the latest web apps development trends, we split the development into two segments: Front-End and Back-End development. Based on the above two development parts, web apps development requires 2 major roles for developers, and those are Front-End and Back-End developers. Subsequently, the web apps development necessitates various skills on both the front-end and backend side to build a complete system. Furthermore, there are several front-end frameworks, popularly, Angular, Reack.Js, Vue.js, JavaScript which again requires different skill sets and developers. However, the most popular choice for backend development, server-side logic is C# and .NET. This creates a complex scenario to build Web UI with front-end technologies and then again server-side logic with back-end technologies.  &lt;/p&gt;

&lt;p&gt;However, Blazor framework is one of the web development platforms for the .Net family that provides the flexibility to develop both backend and front using the same language, C#. It is a component-driven UI framework that takes advantage of shared business objects and code for building applications in both front-end and back-end. &lt;/p&gt;

&lt;p&gt;In this article, we will learn about Blazor framework, how it works with .NET code, development options, structure, and example scenarios. Outlines of this article are given below.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;What is Blazor?&lt;/li&gt;
&lt;li&gt;What is Razor?&lt;/li&gt;
&lt;li&gt;Blazor’s development options&lt;/li&gt;
&lt;li&gt;Blazor Server and Blazor Web Assembly&lt;/li&gt;
&lt;li&gt;When to use Blazor&lt;/li&gt;
&lt;li&gt;Blazor Server vs Blazor WebAssembly&lt;/li&gt;
&lt;li&gt;Decision Criteria for Blazor App&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  What is Blazor?
&lt;/h2&gt;

&lt;p&gt;Blazor is one of the frameworks for the .Net family for web development. Specifically, it is a user-interface framework for .Net applications, which utilizes the same C# language from front-end development. Additionally, it is a component-driven UI framework that provides flexibility to use shared business objects and code for front-end and backend development. Therefore, it enables the .Net developer with the same C# skill to build complete applications. Because of which, this Blazor framework makes the .Net ecosystem more sustainable and efficient.&lt;/p&gt;

&lt;p&gt;In simple team, Blazor is a new client-side framework to ASP.NET for developing UI for web using C# instead of JavaScript, which allows running in the browser using web Assemble. It is a combination of the words Browser and Razor, i.e., Blazor. &lt;/p&gt;

&lt;h2&gt;
  
  
  What is Razor?
&lt;/h2&gt;

&lt;p&gt;Razor is a programming format for ASP.NET that unites HTML with C# or VB.NET for UI. It is a server-based code that creates dynamic web content. Razor pages generally have a .cshtml file extension.&lt;/p&gt;

&lt;h2&gt;
  
  
  Blazor Development Options
&lt;/h2&gt;

&lt;p&gt;We have options for developing applications with Blazor: Blazor Server and Blazor WebAssembly. Based on the selection, we can run the Blazor applications on a server as a part of an ASP.NET or can be published to run in the browser on a client’s machine like a single page application.&lt;/p&gt;

&lt;h2&gt;
  
  
  Blazor Server and Blazor WebAssembly
&lt;/h2&gt;

&lt;p&gt;Based on the hosting of Razor components, Blazor applications can be developed in two: Blazor Server and WebAssembly.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--MpblkI28--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/96w9gb4s0is6tjr3vlj2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--MpblkI28--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/96w9gb4s0is6tjr3vlj2.png" alt="Blazor Server and Blazor WebAssembly" width="880" height="383"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Blazor server&lt;/strong&gt; runs as an implementation of server side as a part of ASP.NET core app where UI events, button clicks, UI updates and interactions are communicated over SignalR connection. In this approach, the UI is generated on a web server and is transmitted to the visitor’s browser upon request. This two-way interaction occurs using SignalR and a web sockets connection. Any change in DOM content is generated from web server and update in automatically via SignalR with Blazor Server framework. This Blazor type has direct access to server and network resources since app is executed in server side.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Blazor WebAssembly&lt;/strong&gt;, on the other hand, runs on the user’s browser as a client application by loading application dependencies, and .NET runtime to the browser. In this approach, we can publish the Blazor applications as like static files without the requirement of a web server or its interactions, since WebAssembly is a technology that executes entirely in the client browser. Although we can do advanced logic in client side using C# in the browser, however, to interact with data, database or other services, this type uses standard web technologies HTTP services. &lt;/p&gt;

&lt;h2&gt;
  
  
  Blazor WebAssembly Vs Blazor Server and Decision of choice
&lt;/h2&gt;

&lt;p&gt;Blazor is a UI framework for web applications in .NET ecosystem which gives capabilities to use .NET skill or C# to build front-end. However, we need to consider various factors when to use Blazor server and Blazor WebAssembly. Let us discuss some criteria to Blazor server or Blazor WebAssembly.&lt;/p&gt;

&lt;p&gt;While creating the project in Visual Studio, we can see both templates, so let check. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--hY06oDmb--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/n3ek51rehpe4nfo4wx0n.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--hY06oDmb--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/n3ek51rehpe4nfo4wx0n.png" alt="Blazor Project Templates" width="880" height="533"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As per above, Blazor Server App template operates on server-side inside an ASP.NET Core app and handles user interactions over a SignalR connection. This template can be used for web apps with rich dynamic user components.&lt;/p&gt;

&lt;p&gt;Blazor WebAssembly App template, on the other hand, runs on WebAssembly and is optionally hosted as ASP.NET core app. This template can be used for web apps with rich dynamic user components.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Both options are great for .NET developers who are familiar with C# and will be beneficial. However, if you are experts with front-end frameworks like JavaScript, Angular or ReactJs, shifting to Blazor may not be the best option.&lt;/li&gt;
&lt;li&gt;Blazor server runs on a web server, so if your existing web servers are running on ASP.NET core, then go for Blazor Server. Blazor WebAssembly can be deployed as static files without the need for server-side rendering.&lt;/li&gt;
&lt;li&gt;Blazor server has direct access to network and server, however, Blazor WebAssembly occasionally communicates with server if required.&lt;/li&gt;
&lt;li&gt;Blazor server loads the UI only when it is connected with server via signalR. Blazor WebAssembly runs in the client browser once it is loaded. Once it is loaded, then the app can run offline as a Progressive web App.&lt;/li&gt;
&lt;li&gt;Blazor server, for complex scenarios, can benefit from distributed applications operating in a data center. Blazor WebAssembly can benefit with client’s native processor speeds.&lt;/li&gt;
&lt;li&gt;Blazor server web app is recommended if there is a need for network security, server configuration and access control for geographical locations. We can secure the communication between browser and server with TSL and some authentication frameworks.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Blazor is a UI framework in .NET environment that adds advantages to developers to use their existing .NET skill for front-end development. In this write-up, I have delved into the Blazor app and its benefits. Additionally, I have explained the development options and types of Blazor app templates. Based on the hosting requirements, we develop server side Blazor as like ASP.NET core or Blazor WebAssembly that run the client’s browser. I have, furthermore, explored both options and decision criteria based on various factors.&lt;/p&gt;

</description>
      <category>blazor</category>
      <category>aspnet</category>
      <category>dotnet</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Blockchain Development with .NET</title>
      <dc:creator>Rijwan Ansari</dc:creator>
      <pubDate>Mon, 07 Nov 2022 13:39:39 +0000</pubDate>
      <link>https://dev.to/rijwanansari/blockchain-development-with-net-3jck</link>
      <guid>https://dev.to/rijwanansari/blockchain-development-with-net-3jck</guid>
      <description>&lt;p&gt;Join us Live for FREE to inspire, learn and deep dive into Blockchain technologies and its development with .NET.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://teams.microsoft.com/registration/xn_aUK8WfkKAc_VylzqqFA,luOnboMf0ECz7JmsVI-9rw,GSDZhnS1w0Cz3bqi3FEcFA,DDnx7Q5P9kuy0wLfodAd3Q,Q6P9jZDjz0-JF2M2llWNww,XunGXVbMuEG6Ty05Q47TOg?mode=read&amp;amp;tenantId=50da7fc6-16af-427e-8073-f572973aaa14"&gt;Registration Link&lt;br&gt;
&lt;/a&gt;&lt;br&gt;
This is a series of Webinars where we discuss, share and demonstrate about Blockchain development with .NET.&lt;br&gt;
Blockchain is an emerging technology of this era. Without any doubt, blockchain is going to make several headlines, news, and research topics in the foreseeable future.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.eventbrite.com/e/blockchain-development-with-net-tickets-462488665047"&gt;https://www.eventbrite.com/e/blockchain-development-with-net-tickets-462488665047&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Blockchain is a technology for record-keeping and contract enforcement. It uses cryptography to make it extremely difficult to modify the previous history. Blockchain technology is referred to as distributed ledger, which is just like an accounting ledger that contains the history of transactions.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--j3zsE5Eq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qgctb0ttfbd5czlvh6hd.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--j3zsE5Eq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qgctb0ttfbd5czlvh6hd.png" alt="Image description" width="880" height="461"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In this series of sessions, we will learn, discuss and deep dive into Blockchain technologies and its development with .NET platform. Furthermore, we develop Blockchain solutions and talk about the applications of it in broader term.&lt;br&gt;
&lt;a href="https://rijsat.com/2022/11/06/journey-blockchain-development-with-net/"&gt;https://rijsat.com/2022/11/06/journey-blockchain-development-with-net/&lt;/a&gt;&lt;/p&gt;

</description>
      <category>blockchain</category>
      <category>dotnet</category>
      <category>crypto</category>
    </item>
    <item>
      <title>Global AI Developer Days Philippines 2022</title>
      <dc:creator>Rijwan Ansari</dc:creator>
      <pubDate>Sat, 22 Oct 2022 05:31:07 +0000</pubDate>
      <link>https://dev.to/rijwanansari/global-ai-developer-days-philippines-2022-ohe</link>
      <guid>https://dev.to/rijwanansari/global-ai-developer-days-philippines-2022-ohe</guid>
      <description>&lt;p&gt;Join us 29 October for a &lt;strong&gt;FREE Online event&lt;/strong&gt; to inspire, learn and deep dive into AI world and technologies.&lt;br&gt;
The Global AI Developer Days in Manila, Philippines is a free online event on 29 October 2022 from 18:00 - 22:00 (MYT).&lt;br&gt;
About this event&lt;br&gt;
Global AI Developer Day Philippines 2022 Join us 29 October for a FREE Online event to inspire, learn and deep dive into AI world and technologies.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.eventbrite.com/e/global-ai-developer-day-philippines-2022-tickets-433420822347"&gt;Registration&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://teams.microsoft.com/l/meetup-join/19%3ameeting_M2NkOWVhNDQtZDljMy00NmJkLTk2MTItNjc3NmRhYzIxOTUy%40thread.v2/0?context=%7B%22Tid%22%3A%2250da7fc6-16af-427e-8073-f572973aaa14%22%2C%22Oid%22%3A%222aae6b18-d561-41a4-8c69-f06feb6a44da%22%2C%22IsBroadcastMeeting%22%3Atrue%2C%22role%22%3A%22a%22%7D&amp;amp;btype=a&amp;amp;role=a"&gt;L﻿ink to join the event&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In this event, we will be inviting experts and MVPs across the globe to present technical sessions on AI and Machine learning with workshops and demonstration.&lt;/p&gt;

&lt;p&gt;A﻿genda:&lt;/p&gt;

&lt;p&gt;6.00-6.15pm - Welcome, Introduction and Keynotes - B﻿y Rijwan Ansari &amp;amp; Satya Karki&lt;/p&gt;

&lt;p&gt;6﻿.15 - 7.00 pm : Building responsible AI models in Azure Machine Learning - By Luis Beltran (Microsoft MVP)&lt;/p&gt;

&lt;p&gt;7﻿.00-7.45 pm : Intro to Machine Learning with ML.NET - By David Patrick (Microsoft MVP)&lt;/p&gt;

&lt;p&gt;7﻿.45 - 8.30 pm : AI-fy your app with Zero ML expertise - By Liji Thomas (Microsoft MVP)&lt;/p&gt;

&lt;p&gt;8﻿.30 - 9.15 pm : Introduction to SQL Server 2022 - By Javier Villegas (Microsoft MVP)&lt;/p&gt;

&lt;p&gt;9﻿.15 - 9.30 pm - QA Discussion and Closing Notes - By Rijwan Ansari and Satya Karki&lt;/p&gt;

&lt;p&gt;The Global AI Developer Days is a free event organized across the world by local communities that are passionate about artificial intelligence on Microsoft Azure. The event is a perfect balance of quality content, awesome talks, and hands-on learning with like-minded peers in your community.&lt;/p&gt;

&lt;p&gt;Stay tuned for more details.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://teams.microsoft.com/l/meetup-join/19%3ameeting_M2NkOWVhNDQtZDljMy00NmJkLTk2MTItNjc3NmRhYzIxOTUy%40thread.v2/0?context=%7B%22Tid%22%3A%2250da7fc6-16af-427e-8073-f572973aaa14%22%2C%22Oid%22%3A%222aae6b18-d561-41a4-8c69-f06feb6a44da%22%2C%22IsBroadcastMeeting%22%3Atrue%2C%22role%22%3A%22a%22%7D&amp;amp;btype=a&amp;amp;role=a"&gt;L﻿ink to Join the event&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--7mihoATr--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7y4avajayv3j32jdlyp4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--7mihoATr--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7y4avajayv3j32jdlyp4.png" alt="Image description" width="880" height="461"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>machinelearning</category>
      <category>ai</category>
      <category>datascience</category>
    </item>
    <item>
      <title>Clean Architecture: Introduction, Concepts and Principles</title>
      <dc:creator>Rijwan Ansari</dc:creator>
      <pubDate>Mon, 22 Aug 2022 08:39:00 +0000</pubDate>
      <link>https://dev.to/rijwanansari/clean-architecture-introduction-concepts-and-principles-2ohj</link>
      <guid>https://dev.to/rijwanansari/clean-architecture-introduction-concepts-and-principles-2ohj</guid>
      <description>&lt;p&gt;Software design and architecture, generally refer to the foundation, structure, and organization of the solution. While designing a sustainable solution, we should always consider maintainability at the top. Maintainability means the solution should be well architected with a strong base. The solution should follow the best principles and design practices.&lt;/p&gt;

&lt;p&gt;In this article, I will explain what a clean architecture is and design a solution in .NET. Furthermore, I will give some insights into solution design principles.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Clean Architecture&lt;/li&gt;
&lt;li&gt;Basic Principles behind Clean Architecture&lt;/li&gt;
&lt;li&gt;Architectural Diagram&lt;/li&gt;
&lt;li&gt;Layers of Clean Architecture&lt;/li&gt;
&lt;li&gt;Designing and structuring a clean architecture Solution&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/xXOcrQpFTTU"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;h2&gt;
  
  
  Clean Architecture
&lt;/h2&gt;

&lt;p&gt;Clean Architecture which is also known as Domain-Driven Design has evolved with considerable improvements in the last several years. Some architecture names used for clean architecture over the years are given below:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Hexagonal Architecture (&lt;a href="https://en.wikipedia.org/wiki/Hexagonal_architecture_(software)"&gt;https://en.wikipedia.org/wiki/Hexagonal_architecture_(software)&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;Onion Architecture&lt;/li&gt;
&lt;li&gt;Domain-Driven Design (DDD) or Domain Centric Architecture&lt;/li&gt;
&lt;li&gt;vertical Slice Architecture&lt;/li&gt;
&lt;li&gt;Clean Architecture&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The above mentioned architectures have similar design principles that have the primary idea to keep the core business logic and application domain at the center of the solution structure. In this architecture, we make core application business logic and domain or entities independent of the presentation layer and data access layer.&lt;/p&gt;

&lt;p&gt;Therefore, the whole idea of this architecture is to allow the core part, which consists of complete business logic and application entities, adaptive and flexible enough to deal with changing technology and interfaces. Additionally, the core application remains the same and independent of presentation layers, infrastructures, and databases.&lt;/p&gt;

&lt;p&gt;In these fast-paced technologies, JavaScript frameworks, web framework, database and external parts become absolute or upgraded, using this clean architecture you can replace these items with minimum efforts. This architecture saves huge time because the core application business logic and entity are independent of framework, presentations, databases, and external parts. Subsequently, the architecture is sustainable and is loosely coupled core business logic and entity with presentation layer or framework. &lt;/p&gt;

&lt;h2&gt;
  
  
  Basic Principles
&lt;/h2&gt;

&lt;p&gt;The primary idea in Clean Architecture is to make the solution adaptive, keep the core business or application logic use cases independent of frontend and external frameworks. In summary, we can outline the following outcomes of clean architecture,&lt;/p&gt;

&lt;h3&gt;
  
  
  Independent of UI
&lt;/h3&gt;

&lt;p&gt;Using clean architecture, we should be able to change UI or presentation layers easily without changing the application layer and so on. UI can be from any front-end framework, or console UI, any web, and can be replaced without changing the other layers or rest of the system.&lt;/p&gt;

&lt;h3&gt;
  
  
  Database Independent
&lt;/h3&gt;

&lt;p&gt;The architecture should be flexible enough to swap the database without affecting the application use cases and entities. The solution can switch the dataset to MS SQL, MySQL, Oracle, MongoDB, or something else.&lt;/p&gt;

&lt;h3&gt;
  
  
  Independent of External agency/libraries/Drivers
&lt;/h3&gt;

&lt;p&gt;The business rules should be independent of external parties or agencies.&lt;/p&gt;

&lt;h3&gt;
  
  
  Framework Independent
&lt;/h3&gt;

&lt;p&gt;The core business or application rules should be independent of the existence of frameworks, libraries for the future. We can include the frameworks but as tools, and the solution should not be completely relied on those.&lt;/p&gt;

&lt;h3&gt;
  
  
  Testable
&lt;/h3&gt;

&lt;p&gt;The architecture should comply with the testing of the core application and business cases and rules without the UI, database, Web server, or any external component.&lt;/p&gt;

&lt;h2&gt;
  
  
  Clean Architecture Diagram
&lt;/h2&gt;

&lt;p&gt;Generally, the clean architecture is delved with primary circular illustration presented by Robot Martin (Uncle Bob).&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ZbzYowaH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6th64uohfwjahwkj9lnn.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ZbzYowaH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6th64uohfwjahwkj9lnn.png" alt="Clean Architecture" width="850" height="624"&gt;&lt;/a&gt;&lt;br&gt;
By Robert C. Martin (Uncle Bob)&lt;/p&gt;

&lt;p&gt;This diagram perfectly shows the high-level concepts behind clean architecture. We can interpret this diagram in two ways, circular or hemisphere, however, you can understand the core idea from both approaches.&lt;/p&gt;

&lt;p&gt;From the diagram, we see that entities are the inner core, which is generally known as business domain entities. It is also called Enterprise Business Rules.&lt;/p&gt;

&lt;p&gt;These business entities are covered by use cases, also called application business rules. These use cases are called from presenters, controllers or gateways as shown in the above diagram. Further external interfaces, DB, UI, or web which are commonly called as public shell or public surface or interface. All the frameworks and drivers are in the outermost layers. Additionally, we can observe that the flow comes from the public shell to inner entities.&lt;/p&gt;

&lt;p&gt;If we understand from another side, the dependencies move from inner to outer, i.e., core to external or public surface. The core inner entities and use cases, also called business and application layers, have no dependencies and are less likely to change. Each layer of this circular diagram has dependencies on the layer next to it. The external layers are most likely to change based on technologies, frameworks and so on, consequently, the solution architecture has less impact on core applications’ logic.​&lt;/p&gt;

&lt;h2&gt;
  
  
  Layers of Clean Architecture
&lt;/h2&gt;

&lt;p&gt;In this section, I will elucidate the layers of clean architecture. We will again observe the layers from Uncle Bob’s illustration.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--OrSBS5r6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zwva4r1bcas4tucms63k.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--OrSBS5r6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zwva4r1bcas4tucms63k.png" alt="Clean Architecture" width="850" height="624"&gt;&lt;/a&gt;&lt;br&gt;
What Is Clean Architecture&lt;br&gt;
By Robert C. Martin (Uncle Bob)&lt;/p&gt;

&lt;h3&gt;
  
  
  Entities
&lt;/h3&gt;

&lt;p&gt;This is also known as enterprise business rules. It consists of plain domains. In this layer, we add objects (entity or domain) with no frameworks and annotations. We add general logics that are applied to every domain like validations, base entities, and so on. They are the least affected by external changes and no dependencies.&lt;/p&gt;

&lt;h3&gt;
  
  
  Use cases
&lt;/h3&gt;

&lt;p&gt;This is a pure logic layer where we write core business or application logic. This is also called Application Business rules. We, in general, use the term service or manager for application use cases. This layer uses a domain layer and builds results. In this use case, we don’t know who triggers or how the result will be presented. However, based on services, we keep business logic independent of UI or database. We may use some libraries, however, only as tools.&lt;/p&gt;

&lt;h3&gt;
  
  
  Interface Adapters
&lt;/h3&gt;

&lt;p&gt;This layer acts as a communicator to convert data into desired format for storing into external sources like database, file system, 3rd parties, and convert data for use cases or business logic. This layer is also called as adapters that necessarily do the conversion of data in both ways. We can consider MVC of GUI or REST APIs at this level that consists of presenters, views, and controllers. It also implements the interfaces of use cases required for external components.&lt;/p&gt;

&lt;h3&gt;
  
  
  External Interfaces, (Frameworks and Drivers)
&lt;/h3&gt;

&lt;p&gt;This is the outermost layer in this clean architecture which changes frequently based on the technologies, updates like database, Web Front-end frameworks. In this layer, we present the data to the UI or database.&lt;/p&gt;

&lt;h2&gt;
  
  
  Solution Designing
&lt;/h2&gt;

&lt;p&gt;Clean architecture is a set of organizing principles, that is the first essential thing we need to understand. We can design the solution in various ways based on the requirements or personal adjustments, however, the core principles must be kept intact and implemented correctly.&lt;/p&gt;

&lt;p&gt;Sample Structure looks like as shown below:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--V1RiXhVc--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xsyx5knf3xdgp7bgilkv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--V1RiXhVc--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xsyx5knf3xdgp7bgilkv.png" alt="Clean Architecture" width="545" height="780"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Domain Class Library – No dependencies, no project or class reference, no logic&lt;/p&gt;

&lt;p&gt;Application Class Library – Only Domain is added as reference project, Pure business logic or services.&lt;/p&gt;

&lt;p&gt;Domain and Application are the core of this solution which are independent of Infrastructure, WebUI, and external libraries.&lt;/p&gt;

&lt;p&gt;Infrastructure Class Library – Application Class is added as reference. This class is responsible for external infrastructure communications like database storage, file system, external systems/APIs/Services and so on.&lt;/p&gt;

&lt;p&gt;We can add more class libraries under this folder for external plugins or SDK to organize the solution in a better way.&lt;/p&gt;

&lt;p&gt;Web UI – This is a presentation web UI project. This can be an MVC, front-end framework. If we are designing an API based solution, then we can keep both Web API and Front-end in this folder host. We add Application and Infrastructure as reference in this project.&lt;/p&gt;

&lt;p&gt;This is a way of organizing and designing a clean architecture solution. This is one way of structuring the solution following the clean architecture principles. However, we can do the organization in several ways, keeping the core values intact.&lt;/p&gt;

&lt;p&gt;In this illustration above, we have kept core applications independent and other infrastructure and web UI are dependent on core applications.&lt;/p&gt;

&lt;p&gt;In the next article, I will design a real solution demonstrating the clean architecture implementation in .NET 6, stay tuned.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;​In this write-up, I have described the clean architecture in-depth with core values. The primary idea behind this clean architecture is to design in such a way that it should be adaptive and flexible enough to handle the changing technologies, external components, and web frontend frameworks. To achieve so, clean architecture provides organizing principles where we keep the core entities and business logic independent of presentation layers, infrastructures, databases, and external agents. Furthermore, I have illustrated an architectural diagram of clean architecture and have delved into it with the core principles. Additionally, I have explained the layers of clean architecture and finally shared the solution design diagram with an example. The above article will give you holistic concepts of clean architecture.&lt;/p&gt;

&lt;p&gt;References&lt;/p&gt;

&lt;p&gt;&lt;a href="https://rijsat.com/2022/02/01/what-is-clean-architecture/"&gt;By Rijsat's Rijwan Ansari&lt;/a&gt;&lt;br&gt;
&lt;a href="https://blog.cleancoder.com/uncle-bob/2012/08/13/the-clean-architecture.html"&gt;By Robert C. Martin (Uncle Bob)&lt;/a&gt;&lt;br&gt;
&lt;a href="https://www.oncehub.com/blog/explaining-clean-architecture"&gt;By Avi Kessner&lt;/a&gt;&lt;/p&gt;

</description>
      <category>softwarearchitect</category>
      <category>cleanarchitecture</category>
      <category>softwaredesign</category>
    </item>
    <item>
      <title>What is DevOps and Its key Principles</title>
      <dc:creator>Rijwan Ansari</dc:creator>
      <pubDate>Mon, 15 Aug 2022 01:45:56 +0000</pubDate>
      <link>https://dev.to/rijwanansari/what-is-devops-and-its-key-principles-47g5</link>
      <guid>https://dev.to/rijwanansari/what-is-devops-and-its-key-principles-47g5</guid>
      <description>&lt;h2&gt;
  
  
  Background
&lt;/h2&gt;

&lt;p&gt;Software development includes several processes like defining scopes, requirement specifications, and use cases, designing solution architect, converting use cases to tasks, writing code, testing and validations, managing releases, and deployments, and then maintenance. These tasks are repetitive and can be highly manual process which can significantly be prone to errors. The software development process comprises different teams from operations, development as well as business. Day by day, these processes are becoming more complex, which shows the need of proper tools and practices to handle it. Additionally, technology had drastically changed and evolved in last one decade, which again adds complexity in development process. Because of development, implementation and operational teams having different skill sets are involved together in software development process, and they can be out of sync, can lack proper visibility which can delay in the overall delivery and result in disappointing the business stakeholders.&lt;/p&gt;

&lt;p&gt;To overcome the complex situations and manage efficiently, we have DevOps.&lt;/p&gt;

&lt;p&gt;In this article, I will cover the following points:&lt;/p&gt;

&lt;p&gt;What is DevOps&lt;br&gt;
Background, why DevOps is required&lt;br&gt;
DevOps culture and How DevOps comes&lt;br&gt;
Development and Operation responsibilities&lt;br&gt;
DevOps Principles and Practices&lt;/p&gt;

&lt;h2&gt;
  
  
  What is DevOps?
&lt;/h2&gt;

&lt;p&gt;We appreciate Patrick Debois, father of DevOps, for outlining the importance of sharing within the DevOps culture. The term was formed by joining Development and Operations.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--EdwrbFRv--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/iapjofiq9ohwhzqf5fnr.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--EdwrbFRv--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/iapjofiq9ohwhzqf5fnr.png" alt="DevOps" width="624" height="309"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;DevOps is not a technology, or a standard, it is commonly referred as culture, DevOps culture.&lt;/p&gt;

&lt;p&gt;DevOps is a software development culture or practice that creates collaboration among development and operations to speed up the quality software delivery in efficient way.&lt;/p&gt;

&lt;p&gt;According to Gartner (&lt;a href="https://www.gartner.com/en/information-technology/glossary/devops"&gt;https://www.gartner.com/en/information-technology/glossary/devops&lt;/a&gt;)&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;DevOps represents a change in IT culture, focusing on rapid IT service delivery through the adoption of agile, lean practices in the context of a system-oriented approach. DevOps emphasizes people (and culture), and it seeks to improve collaboration between operations and development teams. DevOps implementations utilize technology — especially automation tools that can leverage an increasingly programmable and dynamic infrastructure from a life cycle perspective.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;DevOps unifies the members of Development and Operation into one culture and enables proper sync up among them. DevOps includes core development, IT Operations, quality engineering and security to work together to produce reliable and better products faster. What is more, adopting this culture helps organization to respond better to customers, provides current and correct visibility, builds confidence to the product delivery, and know the future implications.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--MZBOqJr0--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hndlsqnqu24fsj4tztqc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--MZBOqJr0--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hndlsqnqu24fsj4tztqc.png" alt="Developer and Operation" width="624" height="252"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;High level Development Responsibilities&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Functional Requirements&lt;br&gt;
Planning Development Task (use cases, user stories and Task)&lt;br&gt;
Writing Code&lt;br&gt;
Build Pipeline&lt;br&gt;
Test Plan and QA&lt;br&gt;
Code Quality and Management&lt;br&gt;
High Level Operation Responsibilities&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Non-Functional Requirements&lt;/strong&gt;&lt;br&gt;
Software Infrastructure (Server or web apps) Readiness&lt;br&gt;
Deployment Task Planning&lt;br&gt;
Deployment&lt;br&gt;
Operations&lt;br&gt;
Monitor&lt;br&gt;
Release Pipeline&lt;/p&gt;

&lt;h2&gt;
  
  
  DevOps Principles and Practices
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--7lTju6MP--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3j9su5iviwcgjt4ohg6i.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--7lTju6MP--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3j9su5iviwcgjt4ohg6i.png" alt="DevOps Principles" width="624" height="247"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;DevOps is all about cultural adoption and mindset change in an organization. DevOps teams establish some practices throughout the application lifecycle; however, we cannot limit the culture only to these principles. Most known principles and practices are under this philosophy:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Collaboration:&lt;/strong&gt; The main aim of DevOps is to bridge the gap across function teams. Create a collaborative environment between development, IT operations and quality assurance. This is a cultural shift to build a unilateral team that has common objectives related with fast and quality deliveries. Additionally, DevOps create a proper sync up, accountability and ownership towards common goal among the team.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Automation:&lt;/strong&gt; Automate the workflows and whatever possible. DevOps encourages automation of some manual and time-consuming processes related with testing, building, releasing, deployments etc. This principle suggests automating the build process, testing, releasing and deployment. Automation enables team to focus on core activities instead of doing manual jobs and quickly response to customer feedbacks. This is a primary action toward continuous integration and continuous delivery (CI/CD) or ability to deliver new version/release to clients in less time.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Incremental Release:&lt;/strong&gt; It is also called as Iteration, where DevOps encourages delivering a project into small chunks throughout the project timeline. It is also encouraged to divide a project into small, testable, and deliverable chunks, so that it can follow the complete process like code merge, test, release and deploy before production one. This incremental release will reduce the error, bugs, and problematic cause before going to final release or production. Additionally, this will create sync up and proper understanding of solution. This Iterative method makes the development process more flexible and error free.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Continuous Improvement:&lt;/strong&gt; Adopting to change is another concept for DevOps. We should be flexible to adopt changes in any aspect if those are related to improvement, optimization, cost effective, technology advancement and likewise. DevOps culture motivates to learn from failure and flexible to act based on circumstances. Change can be on software, customer needs, technology advancement, change to process, methodology and so on for improvement and those should be welcomed as continuous improvement.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Continuous Monitoring:&lt;/strong&gt; DevOps teams need to keep the tack of delivered software and make sure to perform without any issue. Continuous monitoring includes system tacking, monitoring logs, performance, application environments, defects, and so on.&lt;/p&gt;

&lt;p&gt;Some DevOps practices which are based on above principles are given below:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Agile Approach in Software Development&lt;/li&gt;
&lt;li&gt;Continuous Integration and continuous delivery (CI/CD)&lt;/li&gt;
&lt;li&gt;Managing code through Version control&lt;/li&gt;
&lt;li&gt;Infrastructure as Code: flexible to deployment environments where we can create servers or applications for testing which are identical to production and destroy easily.&lt;/li&gt;
&lt;li&gt;Configuration Management&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;In this article, I have discussed how the DevOps concept evolved and why it is essential. DevOps is neither a technology nor a standard but a culture and practice to unite the development, testing and operations for effective, quality, smooth and speedup up the overall software delivery time. I have also elaborated its principles and practices; however, those are not limited only to above mentioned. The core principles enable the collaboration and integration among the development and IT operations, bring automation wherever possible with incremental delivery. It also suggests being flexible to adopt changes for continuous improvement and monitoring. Its primary aim is to sync development and operation for smooth and faster delivery.&lt;/p&gt;

</description>
      <category>devops</category>
      <category>agile</category>
      <category>productivity</category>
    </item>
  </channel>
</rss>
