public PerformanceMonitorConfiguration(PerformanceMonitorConfigurationReader configuration = null, string applicationName = null) { ControllerAction = new ControllerActionConfiguration(); DBFlush = new DataItemConfiguration(); DataConfiguration = new DataConfiguration(); ExposedAPI = new ExposedAPIConfiguration(); if (configuration != null && configuration.Enabled == true) { this.Enabled = true; ControllerAction.Enabled = configuration.ControllerAction?.Enabled ?? false; if (ControllerAction.Enabled) { ControllerAction.FrontEnd.Enabled = configuration.ControllerAction?.FrontEnd.Enabled ?? false; ControllerAction.Time.Enabled = configuration.ControllerAction?.Time?.Enabled ?? false; if (ControllerAction.Time.Enabled) { ControllerAction.Time.MinimumMilliseconds = configuration.ControllerAction?.Time?.MinimumMilliseconds ?? 0; }//end ControllerAction.Time ControllerAction.CPU.Enabled = configuration.ControllerAction?.CPU?.Enabled ?? false; if (ControllerAction.CPU.Enabled) { ControllerAction.CPU.IntervalMilliseconds = configuration.ControllerAction?.CPU?.IntervalMilliseconds ?? 1000; ControllerAction.CPU.MinimumPercentage = configuration.ControllerAction?.CPU?.MinimumPercentage ?? 0; }//end ControllerAction.CPU ControllerAction.RAM.Enabled = configuration.ControllerAction?.RAM?.Enabled ?? false; if (ControllerAction.RAM.Enabled) { ControllerAction.RAM.IntervalMilliseconds = configuration.ControllerAction?.RAM?.IntervalMilliseconds ?? 1000; ControllerAction.RAM.MinimumBytes = configuration.ControllerAction?.RAM?.MinimumBytes ?? 0; }//end ControllerAction.RAM ControllerAction.Database.Enabled = configuration.ControllerAction?.Database?.Enabled ?? false; if (ControllerAction.Database.Enabled) { ControllerAction.Database.Session.Enabled = configuration.ControllerAction?.Database?.Session?.Enabled ?? false; if (ControllerAction.Database.Session.Enabled) { ControllerAction.Database.Session.IgnoreNulls = configuration.ControllerAction?.Database?.Session?.IgnoreNulls ?? true; ControllerAction.Database.Session.MonitoredStatistics = SplitAndClear(configuration.ControllerAction?.Database?.Session?.MonitoredStatistics, null); }// end ControllerAction.Database.Session ControllerAction.Database.Entities.Enabled = configuration.ControllerAction?.Database?.Entities?.Enabled ?? false; if (ControllerAction.Database.Entities.Enabled) { ControllerAction.Database.Entities.IgnoreNulls = configuration.ControllerAction?.Database?.Entities?.IgnoreNulls ?? true; ControllerAction.Database.Entities.MonitoredEntities = SplitAndClear(configuration.ControllerAction?.Database?.Entities?.MonitoredEntities, applicationName); ControllerAction.Database.Entities.MonitoredStatistics = SplitAndClear(configuration.ControllerAction?.Database?.Entities?.MonitoredStatistics, null); } // end ControllerAction.Database.Entities } //end ControllerAction.Database } //end ControllerAction ExposedAPI.Enabled = configuration.ExposedAPI?.Enabled ?? false; if (ExposedAPI.Enabled) { ExposedAPI.Time.Enabled = configuration.ExposedAPI?.Time?.Enabled ?? false; if (ExposedAPI.Time.Enabled) { ExposedAPI.Time.MinimumMilliseconds = configuration.ExposedAPI?.Time?.MinimumMilliseconds ?? 0; }//end ControllerAction.Time ExposedAPI.CPU.Enabled = configuration.ExposedAPI?.CPU?.Enabled ?? false; if (ExposedAPI.CPU.Enabled) { ExposedAPI.CPU.IntervalMilliseconds = configuration.ExposedAPI?.CPU?.IntervalMilliseconds ?? 1000; ExposedAPI.CPU.MinimumPercentage = configuration.ExposedAPI?.CPU?.MinimumPercentage ?? 0; }//end ControllerAction.CPU ExposedAPI.RAM.Enabled = configuration.ExposedAPI?.RAM?.Enabled ?? false; if (ExposedAPI.RAM.Enabled) { ExposedAPI.RAM.IntervalMilliseconds = configuration.ExposedAPI?.RAM?.IntervalMilliseconds ?? 1000; ExposedAPI.RAM.MinimumBytes = configuration.ExposedAPI?.RAM?.MinimumBytes ?? 0; }//end ControllerAction.RAM ExposedAPI.Database.Enabled = configuration.ExposedAPI?.Database?.Enabled ?? false; if (ExposedAPI.Database.Enabled) { ExposedAPI.Database.Session.Enabled = configuration.ExposedAPI?.Database?.Session?.Enabled ?? false; if (ExposedAPI.Database.Session.Enabled) { ExposedAPI.Database.Session.IgnoreNulls = configuration.ExposedAPI?.Database?.Session?.IgnoreNulls ?? true; ExposedAPI.Database.Session.MonitoredStatistics = SplitAndClear(configuration.ExposedAPI?.Database?.Session?.MonitoredStatistics, null); }// end ControllerAction.Database.Session ExposedAPI.Database.Entities.Enabled = configuration.ExposedAPI?.Database?.Entities?.Enabled ?? false; if (ExposedAPI.Database.Entities.Enabled) { ExposedAPI.Database.Entities.IgnoreNulls = configuration.ExposedAPI?.Database?.Entities?.IgnoreNulls ?? true; ExposedAPI.Database.Entities.MonitoredEntities = SplitAndClear(configuration.ExposedAPI?.Database?.Entities?.MonitoredEntities, applicationName); ExposedAPI.Database.Entities.MonitoredStatistics = SplitAndClear(configuration.ExposedAPI?.Database?.Entities?.MonitoredStatistics, null); } // end ExposedAPI.Database.Entities } //end ExposedAPI.Database } //end ExposedAPI DataConfiguration.Enabled = configuration.Data?.Enabled ?? false; if (DataConfiguration.Enabled) { DataConfiguration.ClientData.Enabled = configuration.Data.ClientData?.Enabled ?? false; if (DataConfiguration.ClientData.Enabled) { DataConfiguration.ClientData.Size.Enabled = configuration.Data.ClientData?.Size?.Enabled ?? false; if (DataConfiguration.ClientData.Size.Enabled) { DataConfiguration.ClientData.Size.MinimumBytes = configuration.Data.ClientData?.Size?.MinimumBytes ?? 0; }//end DataConfiguration.ClientData.Size DataConfiguration.ClientData.Time.Enabled = configuration.Data.ClientData?.Time?.Enabled ?? false; if (DataConfiguration.ClientData.Time.Enabled) { DataConfiguration.ClientData.Time.MinimumMilliseconds = configuration.Data.ClientData?.Time?.MinimumMilliseconds ?? 0; }//end ClientData.Time DataConfiguration.ClientData.Database = null; }//end DataConfiguration.ClientData DataConfiguration.Model2DTO.Enabled = configuration.Data.Model2DTO?.Enabled ?? false; if (DataConfiguration.Model2DTO.Enabled) { DataConfiguration.Model2DTO.Size.Enabled = configuration.Data.Model2DTO?.Size?.Enabled ?? false; if (DataConfiguration.Model2DTO.Size.Enabled) { DataConfiguration.Model2DTO.Size.MinimumBytes = configuration.Data.Model2DTO?.Size?.MinimumBytes ?? 0; }//end DataConfiguration.Model2DTO.Size DataConfiguration.Model2DTO.Time.Enabled = configuration.Data.Model2DTO?.Time?.Enabled ?? false; if (DataConfiguration.Model2DTO.Time.Enabled) { DataConfiguration.Model2DTO.Time.MinimumMilliseconds = configuration.Data.Model2DTO?.Time?.MinimumMilliseconds ?? 0; }//end Model2DTO.Time DataConfiguration.Model2DTO.Database = null; }//end DataConfiguration.Model2DTO DataConfiguration.DTO2ViewModel.Enabled = configuration.Data.DTO2ViewModel?.Enabled ?? false; if (DataConfiguration.DTO2ViewModel.Enabled) { DataConfiguration.DTO2ViewModel.Size.Enabled = configuration.Data.DTO2ViewModel?.Size?.Enabled ?? false; if (DataConfiguration.DTO2ViewModel.Size.Enabled) { DataConfiguration.DTO2ViewModel.Size.MinimumBytes = configuration.Data.DTO2ViewModel?.Size?.MinimumBytes ?? 0; }//end DataConfiguration.DTO2ViewModel.Size DataConfiguration.DTO2ViewModel.Time.Enabled = configuration.Data.DTO2ViewModel?.Time?.Enabled ?? false; if (DataConfiguration.DTO2ViewModel.Time.Enabled) { DataConfiguration.DTO2ViewModel.Time.MinimumMilliseconds = configuration.Data.DTO2ViewModel?.Time?.MinimumMilliseconds ?? 0; }//end DataConfiguration.DTO2ViewModel.Time DataConfiguration.DTO2ViewModel.Database.Enabled = configuration.Data?.DTO2ViewModel?.Database?.Enabled ?? false; if (DataConfiguration.DTO2ViewModel.Database.Enabled) { DataConfiguration.DTO2ViewModel.Database.Session.Enabled = configuration.Data?.DTO2ViewModel?.Database?.Session?.Enabled ?? false; if (DataConfiguration.DTO2ViewModel.Database.Session.Enabled) { DataConfiguration.DTO2ViewModel.Database.Session.IgnoreNulls = configuration.Data?.DTO2ViewModel?.Database?.Session?.IgnoreNulls ?? true; DataConfiguration.DTO2ViewModel.Database.Session.MonitoredStatistics = SplitAndClear(configuration.Data?.DTO2ViewModel?.Database?.Session?.MonitoredStatistics, null); }// end Conversions.DTO2ViewModel.Database.Session DataConfiguration.DTO2ViewModel.Database.Entities.Enabled = configuration.Data?.DTO2ViewModel?.Database?.Entities?.Enabled ?? false; if (DataConfiguration.DTO2ViewModel.Database.Entities.Enabled) { DataConfiguration.DTO2ViewModel.Database.Entities.IgnoreNulls = configuration.Data?.DTO2ViewModel?.Database?.Entities?.IgnoreNulls ?? true; DataConfiguration.DTO2ViewModel.Database.Entities.MonitoredEntities = SplitAndClear(configuration.Data?.DTO2ViewModel?.Database?.Entities?.MonitoredEntities, applicationName); DataConfiguration.DTO2ViewModel.Database.Entities.MonitoredStatistics = SplitAndClear(configuration.Data?.DTO2ViewModel?.Database?.Entities?.MonitoredStatistics, null); } // end DataConfiguration.DTO2ViewModel.Database.Entities } //end Conversions.DTO2ViewModel.Database } //end DataConfiguration.DTO2ViewModel } //end DataConfiguration DBFlush.Enabled = configuration.DBFlush?.Enabled ?? false; if (DBFlush.Enabled) { DBFlush.Time.Enabled = configuration.DBFlush?.Time?.Enabled ?? false; if (DBFlush.Time.Enabled) { DBFlush.Time.MinimumMilliseconds = configuration.DBFlush?.Time?.MinimumMilliseconds ?? 0; }//end DBFlush.Time DBFlush.Database.Enabled = configuration.DBFlush?.Database?.Enabled ?? false; if (DBFlush.Database.Enabled) { DBFlush.Database.Session.Enabled = configuration.DBFlush?.Database?.Session?.Enabled ?? false; if (DBFlush.Database.Session.Enabled) { DBFlush.Database.Session.IgnoreNulls = configuration.DBFlush?.Database?.Session?.IgnoreNulls ?? true; DBFlush.Database.Session.MonitoredStatistics = SplitAndClear(configuration.DBFlush?.Database?.Session?.MonitoredStatistics, null); }// end DBFlush.Database.Session DBFlush.Database.Entities.Enabled = configuration.DBFlush?.Database?.Entities?.Enabled ?? false; if (DBFlush.Database.Entities.Enabled) { DBFlush.Database.Entities.IgnoreNulls = configuration.DBFlush?.Database?.Entities?.IgnoreNulls ?? true; DBFlush.Database.Entities.MonitoredEntities = SplitAndClear(configuration.DBFlush?.Database?.Entities?.MonitoredEntities, applicationName); DBFlush.Database.Entities.MonitoredStatistics = SplitAndClear(configuration.DBFlush?.Database?.Entities?.MonitoredStatistics, null); } // end DBFlush.Database.Entities } //end DBFlush.Database } //end DBFlush } }
public DataConfiguration() { ClientData = new DataItemConfiguration(); DTO2ViewModel = new DataItemConfiguration(); Model2DTO = new DataItemConfiguration(); }