public void VisitProgramReference(OracleProgramReference programReference) { if (TryBuildSchemaTooltip(programReference)) { return; } var scriptExtractor = programReference.Container.SemanticModel.DatabaseModel.ObjectScriptExtractor; if (programReference.ObjectNode == _terminal) { var targetObject = programReference.SchemaObject.GetTargetSchemaObject(); if (targetObject != null) { var objectDetailModel = new ObjectDetailsModel { Title = GetFullSchemaObjectToolTip(programReference.SchemaObject), Comment = programReference.SchemaObject.Documentation, Object = targetObject }; ToolTip = new ToolTipView { ScriptExtractor = scriptExtractor, IsExtractDdlVisible = true, DataContext = objectDetailModel }; } return; } if (programReference.DatabaseLinkNode != null || programReference.Metadata == null) { return; } ToolTip = new ToolTipProgram(programReference.Metadata.Identifier.FullyQualifiedIdentifier, programReference.Metadata.Documentation, programReference.Metadata) { ScriptExtractor = scriptExtractor }; }
public void VisitDataObjectReference(OracleDataObjectReference objectReference) { if (TryBuildSchemaTooltip(objectReference)) { return; } if (objectReference.Type == ReferenceType.SchemaObject) { var schemaObject = objectReference.SchemaObject.GetTargetSchemaObject(); if (schemaObject == null) { return; } TableDetailsModel dataModel; var databaseModel = objectReference.Container.SemanticModel.DatabaseModel; var toolTipText = GetFullSchemaObjectToolTip(objectReference.SchemaObject); switch (schemaObject.Type) { case OracleObjectType.MaterializedView: var materializedView = (OracleMaterializedView)schemaObject; dataModel = new MaterializedViewDetailsModel { MaterializedViewTitle = toolTipText, Title = GetObjectTitle(OracleObjectIdentifier.Create(materializedView.Owner, materializedView.TableName), OracleObjectType.Table.ToLower()), MaterializedView = materializedView }; SetPartitionKeys(dataModel); databaseModel.UpdateTableDetailsAsync(schemaObject.FullyQualifiedName, dataModel, CancellationToken.None); ToolTip = new ToolTipMaterializedView { ScriptExtractor = databaseModel.ObjectScriptExtractor, DataContext = dataModel }; break; case OracleObjectType.Table: dataModel = new TableDetailsModel { Title = toolTipText, Table = (OracleTable)schemaObject }; SetPartitionKeys(dataModel); databaseModel.UpdateTableDetailsAsync(schemaObject.FullyQualifiedName, dataModel, CancellationToken.None); ToolTip = new ToolTipTable { ScriptExtractor = databaseModel.ObjectScriptExtractor, DataContext = dataModel }; break; case OracleObjectType.View: var objectDetailModel = new ObjectDetailsModel { Title = toolTipText, Object = schemaObject }; DocumentationDataDictionaryObject documentation; if (TryGetDataDictionaryObjectDocumentation(schemaObject.FullyQualifiedName, out documentation) && !String.IsNullOrWhiteSpace(documentation.Value)) { objectDetailModel.Comment = documentation.Value; } else { databaseModel.UpdateViewDetailsAsync(schemaObject.FullyQualifiedName, objectDetailModel, CancellationToken.None); } ToolTip = new ToolTipView { IsExtractDdlVisible = true, ScriptExtractor = databaseModel.ObjectScriptExtractor, DataContext = objectDetailModel }; break; case OracleObjectType.Sequence: ToolTip = new ToolTipSequence(toolTipText, (OracleSequence)schemaObject); break; } } else { ToolTip = new ToolTipObject { DataContext = $"{objectReference.FullyQualifiedObjectName.ToLabel()} ({objectReference.Type.ToCategoryLabel()})" }; } }