dotnet Core

Nishchit
4 min readOct 18, 2022

--

The new topic studied after the c sharp, database is the dotnet core.

Create ASP.NET Core 6.0 app in Visual Studio 2022

Open Visual Studio 2022, then select Create a new project under the Get started section.

Select the template called ASP.NET Core Web App (Model-View-Controller), and then click the “Next” button.

What should I learn before learning ASP.NET Core

Before you start learning ASP.NET Core, you should have a basic knowledge of HTML CSS and C#. HTML and CSS are used in the Views which forms the UI component of ASP.NET Core MVC. C# is a programming language to create code logics like communicating with database, searching for a value in the data, and so on.

Configure your new project in Visual Studio 2022

Next you will Configure your new project. So add the name of the project as MyFirstCoreMVC and select the location on your drive where you want this application to be created.

Ensure that .NET 6.0 framework is selected and authentication is set to None. Option of Docker should also be un-checked.

Finally click the Create button to create your application.

You app will be created in a few seconds and is ready to be run. Select Start Debugging from the Debug menu (if it prompts you to enable debugging, just click the OK button). You can also start debugging by using a shortcut which is F5 key.

Visual Studio will build your application and open it on your default browser. It will look something like as shown on the below image.

MVC files and folders

Let us understand about these files and folders in your application.

  • wwwroot — contains the static files like images, scripts, external frameworks and libraries like Bootstrap, jQuery.
  • Controllers — This folder contains the controller files.
  • Models — This folder contains the model files.
  • Views — This folder contains the view files.
  • appsettings.json — This file contains configuration settings of the application. You can use it to store database connection string, application variable values and other informations.
  • program.cs — It is your application’s entry point which starts when you run your application. Here you create your application host, choose the web server, add services, authorization and authentications.
  • startup.cs — Note — DOT NET 6.0 does not have startup.cs. If you are using earlier versions of .NET only then you need to have this file in your app. The startup.cs is called from the program.cs file. Here you add services and configure the HTTP pipeline. You also write URL Routes in this file.

The above are just a brief description of these MVC files and folders.

Since the visual studio was already downloaded we wanted to configure the settings .

DOTNET CORE WEBAPI:

Now, we have database and tables are ready. So, let’s move to create Asp.Net Core Web API project, but be sure your development environment is ready for .Net Core application. You should require some of the prerequisites to start this demonstration with Visual Studio 2017. First, you should have installed .NET Core 2.0.0 or above SDK and second, you should have Installed the latest version of Visual Studio 2017 i.e VS 2017 15.7+ version. Once your environment is ready, you are good to go. We should follow below steps while creating new Asp.Net Core Web API.

  1. Open Visual Studio 2017
  2. Click to File > New > Project from the Menu
  3. In New Project windows, from the left panel, select Installed > Visual C# > Web
  4. Select the ASP.NET Core Web Application project template from the middle panel
  5. Enter CoreServices as the name of the project and click OK

Microsoft ASP.NET WEB API:
This package contains the core runtime assemblies for ASP.NET Web API. This package is used by hosts of the ASP.NET Web API runtime. To host a Web API in IIS use the Microsoft.AspNet.WebApi.WebHost package. To host a Web API in your own process use the Microsoft.AspNet.WebApi.SelfHost package.

Description

Task23:
Perform a CRUD using .NET CORE Data First Approach with the following concepts:
1. Toast Notifications
2. FontAwesome
3. Bootstrap Theme
4. Data Annotations
5. Configuration of the controller in the Navbar

Task24:
Perform a CRUD using .NET CORE Code First with the following concepts:
1. Toast Notifications
2. FontAwesome
3. Bootstrap Theme
4. Data Annotations
5. Configuration of the controller in the Navbar

Task25:
Create a .NET Core API either using Data First or Code First and integrate with the Angular Application.

--

--