NET MAUI as a Universal Development Platform

NET MAUI as a Universal Development Platform

NET MAUI
NET MAUI Technology

NET MAUI – Let’s Explore What Is It

At the stage of software design, one of the main points is the environment in which the software product will work. It can be a mobile device, a tablet, or a computer running Windows, Linux, or Raspberry PI operating systems. And what if we need a universal environment where we can run our application without being tied to a device? The .NET MAUI platform comes to the aid of the developer. Let’s talk about this in more detail. The abbreviation MAUI stands for Multi-platform App UI. This system is used to develop user interfaces for both classic desktop applications and mobile devices.

Implemented the NET MAUI platform in the form of 2 types of projects:

  1. Based on Blazor technology.
  2. Based on XAML technology.

NET MAUI Characteristics

Despite the fact that the system is universal, it still has minimal system characteristics and does not support many outdated devices. Consider the minimum versions of operating systems:

  • Android minimum supported version is 5.0 (API 21) if using XAML and Android 6.0(API 23) if we use MAUI Blazor.
  • IOS – minimum supported version 10. If we use .NET MAUI Blazor – IOS 11 and above are required.
  • MacOS is the minimum version of 10.13. and mandatory use of MAC Catalyst.
  • Windows – Microsoft MAUI is available with version 1809 (Windows 10) and Windows 11 is supported.
  • Linux – at the moment it is known that there is support, but there are no minimum system requirements.

From this characteristic, we can notice that the Blazor variant is more demanding on operating systems. If we consider support for Linux systems, and this will work well, this opens up great opportunities for using the MAUI App on other devices, including TVs and projectors. MAUI developers get great development opportunities – code once – works everywhere.

Features of .NET MAUI Technology

A nice feature for MAUI developers is that this system supports hot reloading .NET. What does this mean? This is a feature that allows you to change the program code while the application is running without having to recompile and stop it. Everything happens in real time.

Also, for the convenience of developers, there is access to API and tools for a specific platform. This allows the use of sensors such as a compass, gyroscope, and accelerometer. It is also possible to receive complete information about the device – the level of connection with the Internet.

How the MAUI Architecture Works

Consider the architecture of this technology based on the image provided by Microsoft:

NET MAUI technology

Consider the sequence of code execution.

When running the code, our code interacts directly with the MAUI API. Next MAUI uses its API to use the target platform interface, however, the application code can use the API of the target platform function directly.

 

Next, consider compiling for each operating system:

  • Android – Compilation is from C# to Intermediate Language (IL) then JIT compilation to native assembly.
  • IOS –  compilation happens immediately to ARM assembly code
  • macOS – compile as under IOS with subsequent changes using the Mac Catalyst program
  • Windows – uses the WinUI 3 library to create a ready-made windows maui apps

Comparison of NET MAUI with Other Technologies

At the moment, the main contender for comparison is Xamarin. For a more detailed comparison, consider this technology.

Xamarin is an open-source technology that allows you to create high-performance applications on different architectures at a level of abstraction that allows you to provide control between the main code and the code of the underlying platform, being a link. Does it sound familiar? The question arises: why then should we use NET MAUI? This platform is an evolution of Xamarin Forms – no need to create different projects, 1 project for all operating systems. There is no need to change the logic moving away from the operating system, there is no dependency on the file system either.

Let’s Summarize

 In this article, we examined the main features of the new progressive technology by Microsoft – .NET MAUI. This technology makes it possible to significantly facilitate the development of software, at the moment when the project is simultaneously needed on different operating systems and devices: phones, computers, tablets, and even TVs.

How To Migrate From ASP.NET To ASP.NET Core Losslessly

How To Migrate From ASP.NET To ASP.NET Core Losslessly

ASP NET to NET CORE migrating

Migrating from ASP.NET to ASP.NET Core

Good afternoon, in this article we will look at the basic concept of migrating from ASP.NET to ASP.NET Core. Let’s consider the main possibilities and expediency of this transition. Let’s talk about the benefits, of which there are plenty.

The first and probably one of the most important advantages is cross-platform: all the most famous operating systems are supported, both in the direction of Windows and Unix.

The second and no less important factor is modularity, the system is completely delivered in the form of Nuget packages, which in turn allows you to optimize the application, while simultaneously accelerating both the launch and updating of individual parts, essentially similar to the designer. Additionally, this allows you to integrate additional functionality in less time.

Now let’s say a few words about performance, with the release of each new version of ASP.NET Core, performance grows and noticeably. For example, ASP.NET Core processes 2300% more requests per second than ASP.NET. These huge differences in query speed are brought about by high performance modular conveyor – Middleware. In this implementation, each part of the middleware processes the HTTP request and then decides whether to return the result to the source or pass it to the next part of the middleware.

Based on the above qualities, this transition is appropriate, especially when the load increases and the project is scalable.

Differences in projects

Structure file

The main project structure file is a file with *. csproj. And compared to ASP. Net in ASP. Net Core has been modified and optimized. Let’s look at the main differences. The first thing that catches your eye is the absence of identifiers for other projects, which improves the readability of the code, the file itself is well-edited inside the Visual Studio environment. And also a good difference is the absence of an explicit specification of files, which in turn reduces the risk of conflicts when combining XML.

Point of entry

Previously in ASP. NET, the entry point for an application was the Global.asax file. It performed the tasks of configuring routes and registering filters. One approach is to link the application and the backend that hosts the application, which is not good.

To reduce this relationship, OWIN was introduced. This tool provides a more correct way to use multiple Frameworks, and also allows you to add only modules that are currently needed to the container request. The environment itself uses Startup in terms of service configuration. The startup, in turn, registers middleware services along with the application. The intermediate service component has the ability to add one or more handlers to the processing pipeline. At the same time, the handler, having finished its work, calls the next handler.

What ASP.NET Core downloads, the entry point in the application is the Startup class and this removes the dependency on Global.asax. However, keep in mind that Startup must include the Configure method with a description of the services that will be used in the application.

Storing settings

In Asp. Net, we use Web.config to store settings. by writing the settings to the < appSettings > section as key-value pairs.

Example:

< appSettings >
<add key="Login" value=" LoginValue " />
<add key="Password" value=" PasswordValue " />
</ appSettings >

In this context, we can access variables through the ConfigurationManager of the System.Configuration namespace.

What ASP.NET Core is downloading is that we are not tied to either a section or a file. We can store values in any file and load them using services on initial load. However, we have a default file in the project directory called appsettings.json.

Static files

In terms of working with files, you can also see differences in terms of optimization. Previously, in ASP.NET, such files were stored in various directories and on them we got ref.

However, in ASP.NET Core, such files are already stored in the “wwwroot” root directory, and this can already be optionally changed by the settings. You can call work with files at startup by writing app.UseStaticFiles (); in the Configure method.

Conclusions

In this article, we looked at the main features of ASP. NET and ASP. Net Core for migration. ASP.Net Core technology is actively developed and has a more optimized structure for work, and given the increase in processing speed, this makes it very effective in large projects.

E-Commerce Website Testing Case with a Step-by-Step Checklist Overwiev

E-Commerce Website Testing Case with a Step-by-Step Checklist Overwiev

E-Commerce Website Testing Process with Cases

E-commerce testing

How to Test an Online Store or Application

I bet you won’t find someone in today’s world who hasn’t done any online shopping. A business that relies on its online clients is e-commerce or retail. There are several benefits to buying in person as opposed to online. Convenience, time savings, simple access to goods around the world, etc.

The success of an e-commerce or retail site depends on it. It must be a deserving match for the storefront. Because when you shop at a physical store, you’ve already committed to going there and could even give the brand a shot.

Online options are plenty. Therefore, if interaction isn’t present right away, the user can decide to quit. The business will grow the better the website is.

It is crucial that the application undergoes careful testing because so much depends on it.

Types of Ecommerce Testing

E-commerce test cases

You must test every element of your overall e-commerce system. Typical test formats include:

Type

Session Management

Page Display

Browser Compatibility

Analyzing Content

Usability

Backup and Recovery

Transactions

Processing Orders

Server Testing

Security

What the Procedure Checks

  • The volume of data kept during a session is known as session storage.
  • How long until a session expires is known as the session expiration time.
  • Examining any potential runtime issues
  • Inappropriate font sizes or dead links
  • Dependency on subpar plugins: which should I disable and which should I keep on?
  • Slow downloading of pages
  • Compatibility issues with some browsers
  • A poor user experience with particular browser addons
  • Dad testing on popular operating systems including Windows, Mac OS X, and Linux
  • Examining content for litigation risk or deceptiveness
  • Using only free stock photos
  • Any violation of copyright
  • Individualizing components
  • Detecting and eradicating outdated content
  • Bad design
  • Lack of assistance
  • Website links that can be followed
  • Examining link locations
  • Time between backups
  • Periodically restoring backups to check for them
  • Mistake tolerance
  • Testing for monetary exchanges
  • Record-keeping and auditing
  • Checking the shopping cart’s operation
  • Processing transactions
  • Following orders
  • Orders are recorded
  • Examining the uptime
  • Server stress testing
  • Executing updates
  • Analysis of scalability
  • Ensure that your login credentials are updated frequently.
  • DDoS analysis
  • Computer worms
  • Making sure data is encrypted

E-Commerce test cases

Below, we have listed important segments and test cases for eCommerce website testing.

1. Hero section – Homepage case

Retail websites’ homepages are busy. There is a lot going on there. However, nearly all of them have a Hero Image:
This type of clickable image (which functions as a sort of slideshow) takes up the majority of the page.

In e-commerce, a homepage is more than just a well decorated cover. It also shows promise as a marketing strategy. This page typically has auto-scrolling slideshows or clickable banners that direct readers to particular pages. QA engineers examine the logo, top navigation for logged-in and unlogged-in visitors, and the keyword search when testing a homepage. A QA team’s job is to evaluate the features, page layout, and content visibility. The latter include advertisements such as banners, links to newsletters and social media platforms, and so forth. Here are some examples of test cases for an online store:

  • The speed of page loading is sufficient.
  • The time it takes for a user to log in with the proper credentials is reasonable.
  • The homepage’s typefaces and color scheme are typical.
  • Numerous browsers support controls.
  • The scrolling interval and the carousel automatically scroll.
  • A CTA button or banner click directs a user to the desired page.
  • The links direct visitors to the appropriate pages.
  • The shopping cart, Log In button, and Sign Up button are all clearly marked.

Therefore, homepage test cases essentially include some of the logging, navigation, and UI test cases that we will discuss in more detail later in the text.

2. Search case

Because we can’t always put what customers want to see directly in front of their eyes, search algorithms are crucial to a retail site’s success.

  • Search based on the name of the product, the brand, or, more broadly, the category.
  • Relevant search results are required.
  • There must be a variety of sort choices, including those based on Brand, Price, Reviews, and Ratings, etc.
  • How many results per page should be shown?
  • Are there methods to browse to multi-page results?
  • Additionally, search occurs everywhere. When validating this functionality, kindly take the search drilling down into various levels into account.

3. Sorting and filtering case

These two marginally different but closely connected characteristics significantly improve the use of an e-commerce website. The importance of search filters increases with the size of the item selection, especially for mobile versions. Users prefer to leave a website rather than browse a list of useless suggestions because they find constant scrolling to be annoying. Users can move between categories and sub-options using the filtering feature, and the precise results are then shown in front of them. Users can arrange products in the desired order by sorting them according to criteria such product name, brand, price, etc. QA engineers should be aware of the following in order to provide a flawless experience:

  • A user’s application of a new filter does not disable an existing filter.
  • There is no restriction on how many filters a person may employ.
  • The application of filters is immediately and clearly verified.
  • At the top of the list is a summary of all applied filters.
  • Users can easily get rid of the selected options.
  • All things show in the desired order once a user uses the sorting tool.

4. Shopping cart case

One of the important areas that must be thoroughly tested is the shopping cart. Visitors to a website won’t stay if they can’t add products to their carts. As a result, testing scenarios should include a variety of procedures with a selected item. In other words, the functionality of the shopping cart occasionally needs to handle computations that are fairly complicated. Promotional periods are fixed, there are rules for coupons, vouchers, and discount codes, and everything must work with the logic of the shopping cart.

5. Test cases for the checkout flow case

Because of the wide range of payment methods available nowadays, this step in the purchasing process might be challenging. Making sure the merchant allows the usage of several choices, such as Visa, Mastercard, PayPal, Apple Pay, Google Pay, etc., is the responsibility of QA engineers. In the meantime, the website should also automatically determine the overall cost by applying any applicable fees that the selected payment option entails (if any).

  • Before finishing the transaction, you are prompted to log in or register.
  • Customers can check out and make payments as unregistered guests.
  • Logged-in users who log in again can use previously saved shipping and billing information.
  • Every supported payment method operates as intended.
  • The prices are accurate, even if a particular payment option carries additional fees.
  • After the payment, sensitive data, including payment information, is not kept on file.
  • A successful checkout results in the appearance of an order confirmation page.
  • An email or text message is used to deliver an order confirmation message to the user.
  • Users with an account can view their order status.
  • A user can continue exploring the website after completing the payment.

One of the important areas that must be thoroughly tested is the shopping cart. Visitors to a website won’t stay if they can’t add products to their carts. As a result, testing scenarios should include a variety of procedures with a selected item. In other words, the functionality of the shopping cart occasionally needs to handle computations that are fairly complicated. Promotional periods are fixed, there are rules for coupons, vouchers, and discount codes, and everything must work with the logic of the shopping cart.

6. The account user test case

For a variety of reasons, users might need to update their personal information. It can be due to a credit card’s expiration, a change in the shipping address, an error during registration, etc. Below are a few of test case examples:

  • The My Account section and associated settings are accessible to logged-in users.
  • A user’s account information, such as contacts, a shipping address, a password, and other details, can be updated and modified.
  • In the My Orders section, a user can view and/or manage order status
  • . Previous orders can be viewed and repeated by users.
  • By pressing the matching button, a user can log off.

7. User Interface  case

UX and UI testing frequently go hand in hand, but we’ll talk about them individually. So all the visual components that enable user interaction with the programmed functionalities are covered by UI test cases. UI components that you could encounter on many websites include:

  • buttons;
  • links;
  • checkboxes;
  • radio buttons;
  • dropdown lists;
  • toggles;
  • text fields;
  • date pickers;
  • search fields;
  • tags;
  • sliders;
  • pagination;
  • tooltips;
  • accordions;
  • input fields, etc.

It is crucial to evaluate layout, icons, and images for visual coherence in addition to the functioning of UI elements. This category also includes output elements like pop-up windows, alerts, badges, and notifications. Here are some sample test cases you ought to be aware of in relation to:

  • The signing and logging sections both allow users to submit their credentials.
  • Text can be entered by users in the text areas, including reviews and comments.
  • Each button can be clicked to carry out the pre-programmed functions.
  • The correct pages can be reached by clicking on the navigational elements such as breadcrumbs, tags, and others.
  • After a click or slide, the position of the toggles changes, and each position can be seen.
  • The performance and appearance of UI elements are not device-dependent.

This list is lengthy and contains many different items based on the conditions and pages. A user might only be permitted to check a certain amount of checkboxes, for instance. Therefore, before writing test cases, be sure to carefully review the requirements.

8. User Experience Case

Businesses and online business owners have recently tried to concentrate more on usability and user experience. While an e-commerce website’s visual design contributes to a brand’s overall image, it is important to ensure that it is simple and easy to use. The tests cases listed below assist with this task:

  • The sorting function takes into account all the important factors.
  • It is simple to navigate between pages if search results span more than one.
  • Information may be read easily thanks to the font’s size and color.
  • Product descriptions are accurate and pertinent.
  • Relevant products can be found on all category pages.
  • The page is easy to navigate for the user without having pop-ups obscure much of the content.
  • The branding overall, as well as the design, are consistent across a variety of platforms and screens.

The basic UX test scenarios don’t stop with these. This kind of testing necessitates in-depth user research and perhaps business analysis for productivity gains.

Summary

A website must function on mobile devices in addition to computers. It must be secure and responsive. A data warehouse that supports OLAP and BI should be maintained with the use of ETL operations and an efficient database. Testing for e-commerce should concentrate on all of that. However, whether or not visitors convert to paying consumers is what matters most in e-commerce testing. The conversion rate is the proportion of visits that result in a sale.

What Is Indexing In MongoDB – How to Create and Apply Correctly

What Is Indexing In MongoDB – How to Create and Apply Correctly

MongoDB indexing

MongoDB indexing – your small but important database helper

With the help of a database management system for documents, on MongoDB, you may store a lot of data in documents with different sizes and structures. With the help of MongoDB’s robust querying capabilities, you may filter documents according to predefined criteria. However, as a MongoDB collection expands, finding documents might be like looking for a needle in a haystack.

Due to MongoDB’s query flexibility, it might be challenging for the database engine to anticipate the kind of queries that will be used the most frequently; instead, it must be prepared to find documents regardless of the collection’s size. Because of this, search speed is directly impacted by the volume of data contained in a collection: the larger the data set, the more challenging it is for MongoDB to locate the documents that match the query.

An index is one of the most important tools a database administrator can employ to consciously support the database engine and enhance its performance. You’ll learn about indexes in this article, as well as how to make them and inspect how they’re used when the database runs queries.

How do you create an index in MongoDB?

By means of MongoDB’s built-in shell interface, you can create indexes. Nonetheless, indexes do not exist in isolation. Before creating an index, you must first construct a collection and then a database. In MongoDB, single indexing is simple. Pick a database that has collections in it to get started.

Lets think that our database is named DATA:

use DATA

Once we choose a certain database, we use the createIndex() command procedure to create just a single index.

For example, build one username index in a collection and use it for reverse-order searching:

db.collectionName.createIndex({username: -1})

Every time you query data using the age index, MongoDB is instructed to organize age in reverse order by the negative number (-1) in the code. As a result, since the index takes care of that during queries, you might not need to specify a sorting order.

MongoDB Multikey Indexing

For the purpose of indexing a field in a complicated data array, multikey indexes are useful. For instance, a collection can have intricate user data with that data contained in a separate array. Say your name, height, and age as an example.

The height of each user in that array can be used to generate a multikey index in the following way:

db.customers.createIndex({user.height: 1

The user field’s subset, height, is shown in the code above.

Creating compound index

Multiple indices are combined to form a compound index. For example, in order to build a compound index of address and product category for a customer collection:

db.customer.createIndex({address: 1, products: 1})

Because you didn’t specify a name when building the aforementioned index, MongoDB generates one automatically. However, an underscore is used to denote each index’s name. Therefore, it is less understandable, especially if a compound has more than two indexes.

When building a compound index, be sure to provide a name:

db.customers.createIndex({location: 1, products: 1, weight: -1}, {name: "myCompundIndex"})

In order to see every index in a collection:

db.collectionName.getIndexes()

The above line of code outputs all the indexes in the certain collection.

The dropIndex() method

Using MongoDB’s dropIndex() procedure, you can remove a specific index.

>db.COLLECTION_NAME.dropIndex({KEY:1})

The name of the file on which you want to delete an existing index is “key” in this case. You may alternatively specify the name of the index directly in place of the index specification document (above syntax) as follows:

dropIndex("name_of_the_index")

The dropIndexes() method

With this procedure, a collection’s numerous (specified) indexes are removed.

The DropIndexes() procedure has the following basic syntax:():

>db.COLLECTION_NAME.dropIndexes()

The getIndexes() method

The description of each index in the collection is returned by this procedure.

db.COLLECTION_NAME.getIndexes()

The getIndexes() method

The description of each index in the collection is returned by this procedure.

Conclusion

By reading this article you got an understanding of of the concept of indexes, which are particular data structures which can make your query performance better by decreasing the amount of data MongoDB should analyze.

What’s New In C# 11? How Do You Like It, Elon Musk?

What’s New In C# 11? How Do You Like It, Elon Musk?

C#11

C# 11 preview

All C# developers are looking forward to the release of a new version of the language, which is already declared as version 11. It should also be noted that according to official information, this version will be the last version of C#. Its release is tentatively planned for November 2022.

Also important is that version 11 will be equipped with the sprinkled ” go-live ” support announced by Microsoft. In our case, this is very good news, since Microsoft itself will provide active support for applications written or adapted for C # 11.

Microsoft has repeatedly fueled interest in the new version of the language, and only recently has reliable information appeared about innovations and features with faced by developers. One of these features was the possibility of a multiline string during interpolation, let’s talk about this in more detail.

New String Interpolation Features

Previously, the language supported two types of interpolation: the first was verbatim interpolation ($@””) and non-verbatim interpolation ($””). The main differences between these types were that, with verbatim interpolation, strings can contain variables, there is no need to connect a string with a piece of code or a variable when, for example, we want to display a message. We don’t need to escape quotes. Non-verbatim interpolated strings use escape characters , for example: /n. It looks very complicated, let’s look at an example of what has changed in the new version of the language using the construction example:

var p = $"Result ist : { This.Is .Really.Something () . That.I.Should (
Be Able)[ To.Wrap ()] }.";

New list templates

Innovations have not bypassed list templates . It is also a very nice feature to compare arrays and lists, match different elements, include a cut pattern starting from 0 or more elements.

Checking the null value of the parameter.

Each developer is faced with the need to check the variables and values that come into the processed code. For this, a structure of the form is often used:

if (variable is null)
{
throw new ArgumentNullException ( nameof (variable));
}

The new version of the language introduces the possibility of checking thanks to just two characters ! !. Example:

public static void Check (string variable!!)

{
}

Everything became beautiful and concise. Adding these characters will generate a verification code. Provided that the method has several parameters, then the check will be performed sequentially.

Name of types and names scoped , file , required

The new version has one feature in terms of the name ” scoped “. Now we can’t call the written type ” scoped “. The word is reserved, however there are workarounds such as escaping. This allows you to name the class, before the name itself we will set the @ sign. Example:

class @scoped {}

The same goes for the name file , required.

Handling string literals

The new version announced additional processing of string literals, which was not there before. This allows you to use special characters without escaping them. The new format also allows for built -in encodings, newlines, and spaces.

To process string literals, we just need to use triple quotes at the beginning and end of our character text.

Updated math support

Generic update Math has introduced many features. Now we can use various operators from common contexts .

Also updated Generic support Math with various functions such as:

  • Members that are static and virtual in interfaces
  • Relaxed Right Shift Requirements
  • Unsigned right shift operator
C#11 preview

Conclusions

In this article, we looked at the new features and features of the C# language. By the time of release, more features are likely to appear, but we can test many of them today.

How To Connect Swagger and NET Core Instruction

How To Connect Swagger and NET Core Instruction

How to implement Swagger in ASP.NET Core 6

Swagger ASP NET Core

Let’s start with what is Swagger?

Swagger is an open source set of RESTful API development and documentation rules, specifications, and tools. Developers can use the Swagger framework to create interactive, machine- and human-readable API documentation.

API specifications typically include information such as supported operations, parameters and outputs, authorization requirements, endpoint availability, and license requirements. Swagger can automatically generate this information from the source code by asking the API to return a documentation file based on its annotations.

Swagger assists users in creating, documenting, testing, and consuming RESTful web services. It is compatible with both top-down and bottom-up API development approaches. Swagger can be used to design an API before any code is written in the top-down, or design-first, method. Swagger generates documentation from code written for an API in the bottom-up, or code-first, method.

Swagger component:

Swagger offers a number of open source API tools, including:

  • Swagger Editor- This tool allows developers to create, design, and describe new APIs as well as edit existing ones. The web-based editor renders OpenAPI specifications visually, handles errors, and provides real-time feedback.
  • Swagger Codegen enables developers to generate client library code and SDKs for various platforms.
  • Swagger User Interface- This is a completely customizable tool that assists engineers in creating documentation for a variety of platforms. It can run in any environment.
  • Swagger Inspector is an API documentation testing tool. APIs can be validated without restriction, and the results are automatically saved and accessible in the cloud.

What are the benefits of using Swager

Swagger provides several additional benefits in addition to its goal of standardizing and simplifying API practices.

  • It has a user-friendly interface that serves as a blueprint for APIs.
  • Both developers and non-developers, such as clients or project managers, can understand the documentation.
  • Human and machine readable specifications
  • Produces interactive, testable documentation.
  • Over 40 languages are supported for the creation of API libraries.
  • JSON and YAML formats are acceptable for easier editing.
  • Facilitates the automation of API-related processes.

How to add Swagger on .Net Core 6

When starting an ASP.NET Core 6 project in Visual Studio 2022, you can integrate Swagger to an ASP.NET Core 6 application. The “Enable OpenAPI support” check box in the Visual Studio 2022 project creation wizard is selected by default. This option guarantees the installation of all swagger-related nuget packages and the presence of the Program’s necessary swagger-enabling Program.cs.

Program.cs, why? Because Startup.cs and Program.cs files are now integrated for an uniform experience with ASP.NET Core 6.0.

As you will see on the below image  the Enable OpenAPI support checkbox is checked.

Swagger connection

You can observe that Swagger-related code is already there in Program.cs. The middleware for the development environment is added, and the Swagger service is registered. You can see that the Swashbuckle nuget package has automatically installed for you in Solution Explorer.

Swagger NET Core

Without adding anything extra, if you try and execute the application it will open the Swagger UI for the Weather Forecast API.

And is the weather forecast controller will be created and it will contain the following code:
using Microsoft.AspNetCore.Mvc;

namespace SwaggerDemo.Controllers

{

    [ApiController]

    [Route(“[controller]”)]

    public class WeatherForecastController : ControllerBase

    {

        private static readonly string[] Summaries = new[]

        {

        “Freezing”, “Bracing”, “Chilly”, “Cool”, “Mild”, “Warm”, “Balmy”, “Hot”, “Sweltering”, “Scorching”

    };

        private readonly ILogger _logger;

        public WeatherForecastController(ILogger logger)

        {

            _logger = logger;

        }

        [HttpGet(Name = “GetWeatherForecast”)]

        public IEnumerable Get()

        {

            return Enumerable.Range(1, 5).Select(index => new WeatherForecast

            {

                Date = DateTime.Now.AddDays(index),

                TemperatureC = Random.Shared.Next(-20, 55),

                Summary = Summaries[Random.Shared.Next(Summaries.Length)]

            })

            .ToArray();

        }

    }

}

ASP NET CORE

But why is it that it is automatically redirecting to Swagger UI? Well, it is automatically redirecting there because of “launchUrl”: “swagger” is already set in the launchsettings.json file.

When you  execute the HttpGet method in Swagger, here is how the output will appear:

Swagger NET

Conclusion

I can say with great confidence that Swagger is a fantastic tool for API documentation. It also offers an interface for using the action method executions. Swagger can be modified to meet your needs. For instance, you may adjust how Swagger tests your API and add more information to the documentation for your API.