private bool Equals(ApplicationFiltereableKey other) { var applicationEquals = string.Equals(_application, other._application, StringComparison.CurrentCultureIgnoreCase); var clientEquals = _client == null || string.Equals(_client, other._client, StringComparison.CurrentCultureIgnoreCase); var schemaEquals = _schemaId == null || string.Equals(_schemaId, other._schemaId, StringComparison.CurrentCultureIgnoreCase); return(applicationEquals && clientEquals && schemaEquals); }
protected ApplicationFiltereableKey LookUp(string applicationName, string schemaId, string clientName, IDictionary <ApplicationFiltereableKey, T> storageToUse = null) { var key = new ApplicationFiltereableKey(applicationName, clientName, schemaId); if (storageToUse == null) { storageToUse = _defaultStorage; } if (storageToUse.ContainsKey(key)) { return(key); } //try otb as fallback key = new ApplicationFiltereableKey(applicationName, "otb", schemaId); if (storageToUse.ContainsKey(key)) { return(key); } //second just app + schema key = new ApplicationFiltereableKey(applicationName, null, schemaId); if (storageToUse.ContainsKey(key)) { return(key); } //app + client key = new ApplicationFiltereableKey(applicationName, clientName, null); if (storageToUse.ContainsKey(key)) { return(key); } key = new ApplicationFiltereableKey(applicationName, "otb", null); if (storageToUse.ContainsKey(key)) { return(key); } //last just app return(new ApplicationFiltereableKey(applicationName, null, null)); }