Creating our base project

As we mentioned in our previous chapter on Topshelf, all our microservices will be created as console applications. There are, however, two exceptions to this. Both our Common Messages project and our Base MicroService project will be a Class Library (.NET Framework). They will be referenced by all other projects and will never have the need to run themselves, so we save all that code and overhead.

To start, we should create a new project. Select the project type of Class Library (.NET Framework), label it Base MicroService, and click on OK, as shown in the following screenshot:

Once done, our base project will be created. We now have an empty base project that looks as follows:

namespace Base_MicroService
{
public class Class1
{
}
}

Now, let's install our NuGet packages that we will use. First up is an open source package called CacheManager. This will provide us with a mechanism for cache management for anyone that requires it. You will see later that our microservice manager also has this package installed and makes good use of it. It's your choice whether or not you want your other microservices to have this capability; we have installed it merely as food for thought, as seen here:

If you have not used CacheManager before, I strongly encourage you to read up on it and watch as we implement it throughout our system as our basic caching mechanism. You can learn more about this package at https://github.com/MichaCo/CacheManager.

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

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