private void ValidateDependency(DatabaseDependency dependency) { if (string.IsNullOrEmpty(dependency.EntityName)) { throw new ConfigurationException("entity-name cannot be empty in dependency."); } if (dependencyHT.Contains(dependency.EntityName)) { throw new ConfigurationException("Multiple dependencies can not be added for same object type : " + dependency.EntityName); } if (string.IsNullOrEmpty(dependency.Type)) { throw new ConfigurationException("dependency type cannot be empty in dependency: " + dependency.EntityName); } dependency.Type = dependency.Type.ToLower(); if (dependency.Type != "sql" && dependency.Type != "oracle" && dependency.Type != "oledb") { throw new ConfigurationException("Invalid dependency type."); } if (dependency.Type != "oledb" && string.IsNullOrEmpty(dependency.SqlStatement)) { throw new ConfigurationException("sql-statement cannot be empty for sql/oracle dependency: " + dependency.EntityName); } if (string.IsNullOrEmpty(dependency.CacheKeyFormat) || !dependency.CacheKeyFormat.Contains("[pk]")) { throw new ConfigurationException("Invalid cache-key-format in dependency " + dependency.EntityName + ". cache-key-format must include [pk] tag."); } }
private void ValidateDependency(DatabaseDependency dependency) { if (string.IsNullOrEmpty(dependency.EntityName)) throw new ConfigurationException("entity-name cannot be empty in dependency."); if (dependencyHT.Contains(dependency.EntityName)) throw new ConfigurationException("Multiple dependencies can not be added for same object type : "+ dependency.EntityName ); if(string.IsNullOrEmpty(dependency.Type)) throw new ConfigurationException("dependency type cannot be empty in dependency: " + dependency.EntityName); dependency.Type = dependency.Type.ToLower(); if (dependency.Type != "sql" && dependency.Type != "oracle" && dependency.Type != "oledb") throw new ConfigurationException("Invalid dependency type."); if(dependency.Type!="oledb" && string.IsNullOrEmpty(dependency.SqlStatement)) throw new ConfigurationException("sql-statement cannot be empty for sql/oracle dependency: " + dependency.EntityName); if (string.IsNullOrEmpty(dependency.CacheKeyFormat) || !dependency.CacheKeyFormat.Contains("[pk]")) throw new ConfigurationException("Invalid cache-key-format in dependency " + dependency.EntityName+". cache-key-format must include [pk] tag."); }