Skip to main content

Posts

Showing posts with the label Dotnet Core

A Demo On Clean Architecture | MediatR CQRS Pattern | .NET7 Web API

In this article, we will learn about 'Clean Architecture', 'CQRS Pattern With MediatR' by implementing in .NET7 Web API. Clean Architecture: The Clean Architecture comprises of: Domain Layer Application Layer Infrastructure Layer UI Layer Clean Architecture lives on the dependency inversion principle. In general business logic depends on the data access layer or infrastructure layer. But in clean architecture, it is inverted, which means the data access layer or infrastructure layers depends on the business logic layer(which means the Application Layer) . Domain Layer: the domain layer project will have 'Entities'(Domain Models), 'Domain Services', and 'Value Object'. This project is a parent project and it is independent on all other projects. Application Layer: the application layer project contains business logic files, DTOs, mapper, etc. This project can depend only on the 'Domain Layer Project'. Infrastructure Layer: the infrastruct

Part-5 | Asp.Net Core Identity Series[.NET 7] | Google Authentication

The main objective of this article is: Implementing Google Authentication Install Google Authentication NuGet Package: Let's install the package required for google authentication. Visual Studio 2022: Install-Package Microsoft.AspNetCore.Authentication.Google -Version 7.0.3 Visual Studio Code: dotnet add package Microsoft.AspNetCore.Authentication.Google --version 7.0.3 Register With Google: We need to register our Razor Page application with Google to enable Google authentication. So following are the registration steps with Google. (Step 1) Go to Google API & Service could console at "https://console.cloud.google.com/projectselector2/apis/dashboard?supportedpurview=project" (Step 2) Click on the 'Create Project' button. (Step 3) Give a project name and then click on the 'Create' button. (Step 4) On creating a project successfully, we can observe it as a selected project in our dashboard like below. (Step 5) Select 'OAuth Consent Screen' l

Part-4 | Asp.Net Core Identity Series[.NET 7] | Sending Two-Factor Authentication(2FA) Code To Phone

The main objectives of this article are: Sending Two-Factor Authentication(2FA) Code to Phone Enable Phone 2FA: In the Asp.Net Core Identity application to enable 'Phone' Two-Factor Authentication, ensure our 'AspNetUser' table following fields has appropriate data: PhoneNumber - Should have valid phone number along with country code PhoneNumberConfirmed - must be true TwoFactorEnabled - must be true Twilio Setup: Twilio is a third-party service provider which provides services like SMS, Voice Calls, Chats, etc. (Step 1) Go to the Twilio website 'https://www.twilio.com/' and SignUp. (Step 2) Now Login => We entered into the Twilio console dashboard => Here create a project and you will get 'Account SID', 'Auth Token', and 'My Twilio Phone Number(which will be our From Phone Number). (Step 3) I'm going to use the Free credits to set up the SMS service. So here is one limitation with free credits we have to register all testing &

.NET 7 Web API CRUD Using Entity Framework Core

In this article, we are going to implement a sample .NET 7 Web API CRUD using the Entity Framework Core. Web API: Web API is a framework for building HTTP services that can be accessed from any client like browser, mobile devices, and desktop apps. In simple terminology API(Application Programming Interface) means an interface module that contains programming functions that can be requested via HTTP calls either to fetch or update data for their respective clients. Some of the Key Characteristics of API: Supports HTTP verbs like 'GET', 'POST', 'PUT', 'DELETE', etc. Supports default responses like 'XML' and 'JSON'. Also can define custom responses. Supports self-hosting or individual hosting, so that all different kinds of apps can consume it. Authentication and Authorization are easy to implement. The ideal platform to build the REST full services. Install The SQL Server And SQL Management Studio: Let's install the SQL server on our l