private Option <Uri> GetSynonymTargetUrl(Identifier identifier, SynonymTargets targets) { if (targets.Tables.ContainsKey(identifier)) { return(new Uri(UrlRouter.GetTableUrl(identifier), UriKind.Relative)); } if (targets.Views.ContainsKey(identifier)) { return(new Uri(UrlRouter.GetViewUrl(identifier), UriKind.Relative)); } if (targets.Sequences.ContainsKey(identifier)) { return(new Uri(UrlRouter.GetSequenceUrl(identifier), UriKind.Relative)); } if (targets.Synonyms.ContainsKey(identifier)) { return(new Uri(UrlRouter.GetSynonymUrl(identifier), UriKind.Relative)); } if (targets.Routines.ContainsKey(identifier)) { return(new Uri(UrlRouter.GetRoutineUrl(identifier), UriKind.Relative)); } return(Option <Uri> .None); }
private IReadOnlyCollection <Link> GetReferenceTargetLinks(string rootPath, Identifier objectName, Identifier referenceName) { if (rootPath == null) { throw new ArgumentNullException(nameof(rootPath)); } if (objectName == null) { throw new ArgumentNullException(nameof(objectName)); } if (referenceName == null) { throw new ArgumentNullException(nameof(referenceName)); } var qualifiedReference = QualifyReferenceName(objectName, referenceName); var isSelfReference = string.Equals(objectName.Schema, qualifiedReference.Schema, StringComparison.OrdinalIgnoreCase) && string.Equals(objectName.LocalName, qualifiedReference.LocalName, StringComparison.OrdinalIgnoreCase); if (isSelfReference) { return(Array.Empty <Link>()); } var result = new List <Link>(); var matchingTables = GetMatchingObjects(TableNames, qualifiedReference) .Select(name => new Link(name, new Uri(rootPath + UrlRouter.GetTableUrl(name), UriKind.Relative))); result.AddRange(matchingTables); var matchingViews = GetMatchingObjects(ViewNames, qualifiedReference) .Select(name => new Link(name, new Uri(rootPath + UrlRouter.GetViewUrl(name), UriKind.Relative))); result.AddRange(matchingViews); var matchingSequences = GetMatchingObjects(SequenceNames, qualifiedReference) .Select(name => new Link(name, new Uri(rootPath + UrlRouter.GetSequenceUrl(name), UriKind.Relative))); result.AddRange(matchingSequences); var matchingSynonyms = GetMatchingObjects(SynonymNames, qualifiedReference) .Select(name => new Link(name, new Uri(rootPath + UrlRouter.GetSynonymUrl(name), UriKind.Relative))); result.AddRange(matchingSynonyms); var matchingRoutines = GetMatchingObjects(RoutineNames, qualifiedReference) .Select(name => new Link(name, new Uri(rootPath + UrlRouter.GetRoutineUrl(name), UriKind.Relative))); result.AddRange(matchingRoutines); return(result); }
public View(Identifier viewName, uint columnCount, bool isMaterialized) { if (viewName == null) { throw new ArgumentNullException(nameof(viewName)); } Name = viewName.ToVisibleName(); ViewUrl = UrlRouter.GetViewUrl(viewName); ColumnCount = columnCount; MaterializedText = isMaterialized ? "✓" : "✗"; }
protected override IRuleMessage BuildViewMessage(Identifier viewName) { if (viewName == null) { throw new ArgumentNullException(nameof(viewName)); } var viewUrl = UrlRouter.GetViewUrl(viewName); var viewLink = $"<a href=\"{ viewUrl }\">{ HttpUtility.HtmlEncode(viewName.ToVisibleName()) }</a>"; var messageText = $"The view { viewLink } contains whitespace and requires quoting to be used. Consider renaming to remove any whitespace."; return(new RuleMessage(RuleId, RuleTitle, Level, messageText)); }
protected override IRuleMessage BuildMessage(Identifier viewName) { if (viewName == null) { throw new ArgumentNullException(nameof(viewName)); } var viewUrl = UrlRouter.GetViewUrl(viewName); var viewLink = $"<a href=\"{ viewUrl }\">{ HttpUtility.HtmlEncode(viewName.ToVisibleName()) }</a>"; var messageText = $"The view { viewLink } was unable to be queried. This may indicate an incorrect view definition."; return(new RuleMessage(RuleId, RuleTitle, Level, messageText)); }
protected override IRuleMessage BuildViewMessage(Identifier viewName) { if (viewName == null) { throw new ArgumentNullException(nameof(viewName)); } var viewUrl = UrlRouter.GetViewUrl(viewName); var viewLink = $"<a href=\"{ viewUrl }\">{ HttpUtility.HtmlEncode(viewName.ToVisibleName()) }</a>"; var messageText = $"The view { viewLink } is also a database keyword and may require quoting to be used. Consider renaming to a non-keyword name."; return(new RuleMessage(RuleId, RuleTitle, Level, messageText)); }
public ViewColumn( Identifier viewName, int ordinalPosition, string columnName, string typeDefinition, bool isNullable ) : base( viewName, ordinalPosition, columnName, typeDefinition, isNullable, string.Empty ) { TableUrl = UrlRouter.GetViewUrl(viewName); }