Sphyrnidae Common Library  2.0.1
Shared Utilities/Library
Application Settings

Overview

Application Settings are those settings that are application-specific. Because this is application-specific, there is no default implementation. It will be up to you to implement the interface, and setup Dependency Injection (DI) for this implementation. Best practice is to place your implementation in a "Settings" folder off the root of your project.

The IApplicationSettings interface has the following properties to implement:

  1. Name (The name of your application)
  2. Description (Description for your application)
  3. ContactName (Name of the contact person - eg. yourself)
  4. ContactEmail (Email address of the contact person)
  5. Environment (Name of the hosting environment - should be pulled from IWebHostEnvironment.EnvironmentName)

Interface: IApplicationSettings

Mock: ApplicationSettingsMock

Implementation: None (You must implement)

Where Used

  1. AuthenticationMiddleware and IApiAuthenticationWebService: API to API authentication
  2. Swagger Documentation
  3. IEmail: Application name appears in some email subject emails
  4. IFeatureToggleServices: Features can be application-specific
  5. ILogger: Application is logged on every statement
  6. Sphyrnidae.Common.UserPreference.Interfaces. IUserPreferenceServices "IUserPreferenceServices": User preferences can be application-specific
  7. IVariableServices: Variables/Configurations can be application-specific

Examples

    public class MyApplicationSettings : IApplicationSettings
    {
        protected IWebHostEnvironment WebHost { get; }
        public MyApplicationSettings(IWebHostEnvironment webHost) => WebHost = webHost;
        public string Name => "My Application";
        public string Description => "Description of my application";
        public string ContactName => "Me";
        public string ContactEmail => "foo@foo.com";
        public string Environment => WebHost.EnvironmentName;
    }