/// <summary> /// Initializes a new instance of Flesk.Accelerator.ViewState.ViewStateStorageSettings /// object, using a XmlNode containing data. /// </summary> /// <param name="node"></param> public ViewStateStorageSettings(XmlNode node) { if (node == null) { return; } var handlerName = node.Attributes[nameof(PersistenceHandler)]; if (handlerName != null) { PersistenceHandler = handlerName.Value; } var storagePath = node.Attributes["StoragePath"]; if (storagePath != null) { _storagePath = storagePath.Value; } var connString = node.Attributes[nameof(ConnectionString)]; if (connString != null) { _connectionString = connString.Value; } var tableName = node.Attributes[nameof(TableName)]; if (tableName != null) { _tableName = tableName.Value; } var storageMethod = node.Attributes["StorageMethod"]; if (storageMethod != null) { try { _method = (ViewStateStorageMethod) Enum.Parse(typeof(ViewStateStorageMethod), storageMethod.Value, true); } #pragma warning disable CC0004 // Catch block cannot be empty #pragma warning disable RECS0022 // A catch clause that catches System.Exception and has an empty body catch { } #pragma warning restore RECS0022 // A catch clause that catches System.Exception and has an empty body #pragma warning restore CC0004 // Catch block cannot be empty } var compressed = node.Attributes[nameof(Compressed)]; if (compressed != null) { _compressed = (string.Compare(compressed.Value, bool.TrueString, StringComparison.OrdinalIgnoreCase) == 0); } var behavior = node.Attributes[nameof(RequestBehavior)]; if (behavior != null) { try { _behavior = (ViewStateStorageBehavior) Enum.Parse(typeof(ViewStateStorageBehavior), behavior.Value, true); } #pragma warning disable CC0004 // Catch block cannot be empty #pragma warning disable RECS0022 // A catch clause that catches System.Exception and has an empty body catch { } #pragma warning restore RECS0022 // A catch clause that catches System.Exception and has an empty body #pragma warning restore CC0004 // Catch block cannot be empty } var viewstatefilesMaxAge = node.Attributes[nameof(ViewStateFilesMaxAge)]; if (viewstatefilesMaxAge != null) { try { _fileage = Double.Parse(viewstatefilesMaxAge.Value); } #pragma warning disable CC0004 // Catch block cannot be empty #pragma warning disable RECS0022 // A catch clause that catches System.Exception and has an empty body catch { } #pragma warning restore RECS0022 // A catch clause that catches System.Exception and has an empty body #pragma warning restore CC0004 // Catch block cannot be empty } var viewstateCleanupInterval = node.Attributes[nameof(ViewStateCleanupInterval)]; if (viewstateCleanupInterval != null) { try { _maxAge = TimeSpan.Parse(viewstateCleanupInterval.Value); } #pragma warning disable CC0004 // Catch block cannot be empty #pragma warning disable RECS0022 // A catch clause that catches System.Exception and has an empty body catch { } #pragma warning restore RECS0022 // A catch clause that catches System.Exception and has an empty body #pragma warning restore CC0004 // Catch block cannot be empty } }
/// <summary> /// Initializes a new instance of Flesk.Accelerator.ViewState.ViewStateStorageSettings /// object, using a XmlNode containing data. /// </summary> /// <param name="node"></param> public ViewStateStorageSettings(XmlNode node) { if (node == null) { return; } var handlerName = node.Attributes[nameof(PersistenceHandler)]; if (handlerName != null) { PersistenceHandler = handlerName.Value; } var storagePath = node.Attributes["StoragePath"]; if (storagePath != null) { _storagePath = storagePath.Value; } var connString = node.Attributes[nameof(ConnectionString)]; if (connString != null) { _connectionString = connString.Value; } var tableName = node.Attributes[nameof(TableName)]; if (tableName != null) { _tableName = tableName.Value; } var storageMethod = node.Attributes["StorageMethod"]; if (storageMethod != null) { try { _method = (ViewStateStorageMethod)Enum.Parse(typeof(ViewStateStorageMethod), storageMethod.Value, true); } #pragma warning disable CC0004 // Catch block cannot be empty #pragma warning disable RECS0022 // A catch clause that catches System.Exception and has an empty body catch { } #pragma warning restore RECS0022 // A catch clause that catches System.Exception and has an empty body #pragma warning restore CC0004 // Catch block cannot be empty } var compressed = node.Attributes[nameof(Compressed)]; if (compressed != null) { _compressed = (string.Compare(compressed.Value, bool.TrueString, StringComparison.OrdinalIgnoreCase) == 0); } var behavior = node.Attributes[nameof(RequestBehavior)]; if (behavior != null) { try { _behavior = (ViewStateStorageBehavior)Enum.Parse(typeof(ViewStateStorageBehavior), behavior.Value, true); } #pragma warning disable CC0004 // Catch block cannot be empty #pragma warning disable RECS0022 // A catch clause that catches System.Exception and has an empty body catch { } #pragma warning restore RECS0022 // A catch clause that catches System.Exception and has an empty body #pragma warning restore CC0004 // Catch block cannot be empty } var viewstatefilesMaxAge = node.Attributes[nameof(ViewStateFilesMaxAge)]; if (viewstatefilesMaxAge != null) { try { _fileage = Double.Parse(viewstatefilesMaxAge.Value); } #pragma warning disable CC0004 // Catch block cannot be empty #pragma warning disable RECS0022 // A catch clause that catches System.Exception and has an empty body catch { } #pragma warning restore RECS0022 // A catch clause that catches System.Exception and has an empty body #pragma warning restore CC0004 // Catch block cannot be empty } var viewstateCleanupInterval = node.Attributes[nameof(ViewStateCleanupInterval)]; if (viewstateCleanupInterval != null) { try { _maxAge = TimeSpan.Parse(viewstateCleanupInterval.Value); } #pragma warning disable CC0004 // Catch block cannot be empty #pragma warning disable RECS0022 // A catch clause that catches System.Exception and has an empty body catch { } #pragma warning restore RECS0022 // A catch clause that catches System.Exception and has an empty body #pragma warning restore CC0004 // Catch block cannot be empty } }