Friday, April 10, 2020
Access config settings directly from class library
In the previous post we
saw on how to access the config settings
by creating a custom class and injecting it in the startup, so that it can be
used in the controllers. In this case the startup and the controller classes
are in the same project.
Access config settings using custom class
In the previous post we
saw on how to use Dependency Injection
to get the configuration options in the Controller
classes. In this post we will see another way of reading the configuration
setting using a custom class.
Access config settings from appsetting.json in Controller using DI
In the previous post we
saw the options to read config
setting values in Startup, in this post we shall see on how to get the config
setting values in the controller. We will inject the configuration object to
the service and the same will be made available in the Controller using Dependency Injection.
Thursday, April 9, 2020
Access configuration settings from custom configuration files
In the previous post we
saw on how to read configuration settings from the appsettings.json file. While this holds good for most of the cases,
there might be situations where we will need our custom configuration file,
when we use our own configuration file, we need to specify the file in the
Startup and add the file to the ConfigurationBuilder.
In the below case we have a custom configuration file mysettings.json, and we will read the configuration settings from our config file.
In the below case we have a custom configuration file mysettings.json, and we will read the configuration settings from our config file.
Subscribe to:
Posts (Atom)