If you are using Visual Studio to develop your web application, you will find that there are a number of different ASP.NET Core Visual Studio templates to choose from.
Each of these C# project templates sets up the foundations for your web application.
This means that you can spend less time on configuring your application, and more time writing it.
Once you select a template, it will automatically create a new solution in Visual Studio alongside a project.
ASP.NET Core MVC
The MVC (model-view-controller) design pattern has been around for some time now.
It allows you to create a controller, which is a class that holds actions. Each action represents an endpoint in the web application, and this is represented using a method.
Each action allows a response to be returned the browser. This could return a razor view, which is an enhanced way of displaying dynamic HTML.
Each action has the ability to include a model. A model is a class that holds data for that action. The main purpose of the model is to pass that data from the action to the view, should one be needed.
ASP.NET Core Web API
ASP.NET Core Web API's also use the MVC design pattern.
The only real difference is that it wouldn't traditionally use views.
Instead, for each API endpoint, a response would be returned in JSON format.
API's are used to manage data between different applications. The advantage of using an API is that you can share data between many different applications that rely on the same data.
They are also used in client-side frameworks, such as Blazor WebAssembly, React and Angular. Client-side frameworks do not have the ability to perform server-side functions on their own, so using an API gets round this issue.
Blazor is Microsoft's newest web framework.
A major feature of Blazor is that you can develop a front-end application using C#.
Blazor comes with two different hosting models:
The Blazor Server hosting model allows you to create a server-side application that supports SEO.
The way it works is that the Blazor application has a constant connection to the server. This is established by using a SignalR connection.
The advantage of this is that you can share front-end and back-end functionality within the same application.
The Blazor WebAssembly hosting model uses WebAssembly which is available on modern day web browsers.
WebAssembly is a new client-side technology that allows you to download an application into a browser. So, with Blazor, it downloads the .NET project into your web browser.
This means that you can write front-end functionality using C#, and it can work offline.
Just say you have applications that share common classes. It would be silly to create separate instances for each application.
In this instance, you would create a class library, and hold all the common classes within it.
From there, you can include that class library in the applications that need it. Now you can use the classes and their methods where appropriate.