-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating
Mastering Minimal APIs in ASP.NET Core
By :
We have just defined how you can load data with the options pattern within an ASP.NET application. In this section, we want to describe how you can configure an application and take advantage of everything we saw in the previous section.
With the birth of .NET Core, the standard has moved from the Web.config file to the appsettings.json file. The configurations can also be read from other sources, such as other file formats like the old .ini file or a positional file.
In minimal APIs, the options pattern feature remains unchanged, but in the next few paragraphs, we will see how to reuse the interfaces or the appsettings.json file structure.
The object provided from .NET is IConfiguration, which allows us to read some specific configurations inside the appsettings file.
But, as described earlier, this interface does much more than just access a file for reading.
The following extract from the official documentation...