Creating projects

We will start with an empty project. You need to create a .NET Core web application and don't forget to enable the creation of a Git repository for it to keep the history of your changes.

We would expect our system to get more substantial, but we start small. Let's call the solution Marketplace, and our first project would be called just that. The type of project to create is ASP.NET Core Web Application. This project is our startup, which will be executed by the .NET runtime.

Creating a solution in Visual Studio

Visual Studio for Mac and Rider allow you to specify the type Empty right away, but in Visual Studio for Windows, you will need to select this on the next screen.

Selecting the Empty web application template

We already discussed that the domain model should not have dependencies on infrastructure. In general, it should not have references to anything that standard language types, itself and some set of base classes and interfaces, if necessary. To enforce this, let's create a separate project where we will put all our domain objects. Add one more project to the solution and call it Marketplace.Domain. This project will not be executed by itself, so the project type should be Class Library and don't forget to change the framework for it to netstandard2.0 (or later).

Adding a .NET Standard 2.0 class library

Then, we need to add one more project for unit tests. You can do it by adding a project in your solution, which would be called Marketplace.Tests. The project type is Unit Test Project, and type is xUnit since we will be using xUnit.net testing framework for our tests in this book.

Adding a xUnit.net test project

The solution should look like this now:

It makes sense to remove the wwwroot and Properties folders, Class1.cs and UnitTest1.cs files since we will create new classes from scratch and we do not need empty folders to hang around.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.117.99.71