Exemple #1
0
 public AuthService(ILogger log, string Name, ServiceDegradationWeight Weight, TimeSpan TimeOut, int Retry = 3)
 {
     this.FriendlyName      = Name;
     this.DegradationWeight = Weight;
     this._retry            = Retry;
     this._timespan         = TimeOut;
 }
 public RandomDogService(ILogger Log, string Name, ServiceDegradationWeight Weight, TimeSpan TimeOut, Policy RetryPolicy = null)
 {
     log = Log;
     this.FriendlyName   = Name;
     this.DegradedWeight = Weight;
     this._policy        = RetryPolicy ?? default_policy;
     this._timeOut       = TimeOut;
 }
Exemple #3
0
        public OpenLibraryService(ILogger Log, string Name, ServiceDegradationWeight Weight, TimeSpan TimeOut, Policy RetryPolicy = null)
        {
            log = Log;
            this.FriendlyName   = Name;
            this.DegradedWeight = Weight;
            this._policy        = RetryPolicy ?? default_policy;
            this._timeOut       = TimeOut;

            var gs = new GlobalSettings()
                     .With(
                new LoggerConfiguration().WriteTo.ColoredConsole().CreateLogger(),
                TimeSpan.FromMinutes(10)
                );

            var AppSettings = gs.ForApplication("ExternalConfigurationStore");

            gs.ClearAppSettings();
            //var UserSettings = new GlobalSettings().With(
            //    new LoggerConfiguration().WriteTo.ColoredConsole().CreateLogger())
            //    .ForUser("*****@*****.**");

            //if (!((ExpandoObject)AppSettings).Contains("ConnectionStrings"))

            if (!gs.Contains(AppSettings, "ConnectionStrings"))
            {
                gs.AddAppSettingCollection(AppSettings, "ConnectionStrings");
            }

            if (!gs.Contains(AppSettings, "Azure"))
            {
                gs.AddAppSettingCollection(AppSettings.ConnectionStrings, "Azure");
            }

            if (!gs.Contains(AppSettings, "Services"))
            {
                gs.AddAppSettingCollection(AppSettings, "Services");
            }

            if (!gs.Contains(AppSettings, "RandomDog"))
            {
                gs.AddAppSettingCollection(AppSettings.Services, "RandomDog");
            }
        }
 protected virtual int GetDegratedPercentageSeverityMapItem(ServiceState State, ServiceDegradationWeight Weight) => _degradedSettingsMap[new Tuple <ServiceState, ServiceDegradationWeight>(State, Weight)].Item2;
 protected virtual ServiceDegradationState GetDegratedStateMapItem(ServiceState State, ServiceDegradationWeight Weight) => _degradedSettingsMap[new Tuple <ServiceState, ServiceDegradationWeight>(State, Weight)].Item1;
 protected virtual void AddDegratedSettingMapItem(ServiceState State, ServiceDegradationWeight Weight, ServiceDegradationState DegradationState, int DegradationPercentage) => _degradedSettingsMap.Add(new Tuple <ServiceState, ServiceDegradationWeight>(State, Weight), new Tuple <ServiceDegradationState, int>(DegradationState, DegradationPercentage));