/// <summary>
        /// Sets the recommended application setup for a Web Api.
        /// </summary>
        /// <param name="appSettingGetter">How to get app settings for <see cref="ApplicationSetup.Name"/>,
        /// <see cref="ApplicationSetup.Tenant"/>, <see cref="ApplicationSetup.RunTimeLevel"/></param>
        /// <remarks>
        /// If you want to use <see cref="ConfigurationManager"/> for retreiving app settings, you can use <see cref="ConfigurationManagerAppSettings"/>
        ///  as the <paramref name="appSettingGetter"/>.
        /// The settings that must exists int the <paramref name="appSettingGetter"/> ApplicationName, Organization, Environment and RunTimeLevel.
        /// </remarks>
        public static void WebBasicSetup(IAppSettingGetter appSettingGetter)
        {
            InternalContract.RequireNotNull(appSettingGetter, nameof(appSettingGetter));
            var appSettings  = new AppSettings(appSettingGetter);
            var name         = appSettings.GetString("ApplicationName", true);
            var tenant       = appSettings.GetTenant("Organization", "Environment", true);
            var runTimeLevel = appSettings.GetEnum <RunTimeLevelEnum>("RunTimeLevel", true);

            WebBasicSetup(name, tenant, runTimeLevel);
            FulcrumApplication.AppSettings = new AppSettings(appSettingGetter);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Can get app settings by using the <paramref name="appSettingGetter"/>.
 /// </summary>
 /// <param name="appSettingGetter"></param>
 public AppSettings(IAppSettingGetter appSettingGetter)
 {
     _appSettingGetter = appSettingGetter;
 }