add table type to process and publish results (#1448)

* add table type to process and publish results

* make generic property bag

* review comments

* remove unused code

* edit comment
This commit is contained in:
Aditya Bist
2022-03-31 21:01:37 -07:00
committed by GitHub
parent 3452c43a51
commit 54dc04c533
5 changed files with 59 additions and 5 deletions

View File

@@ -119,7 +119,8 @@ namespace Microsoft.SqlTools.ServiceLayer.TableDesigner
ViewModel = this.GetTableViewModel(requestParams.TableInfo),
IsValid = issues.Where(i => i.Severity == IssueSeverity.Error).Count() == 0,
Issues = issues.ToArray(),
View = refreshViewRequired ? this.GetDesignerViewInfo(requestParams.TableInfo) : null
View = refreshViewRequired ? this.GetDesignerViewInfo(requestParams.TableInfo) : null,
Metadata = this.GetMetadata(requestParams.TableInfo)
});
});
}
@@ -147,7 +148,8 @@ namespace Microsoft.SqlTools.ServiceLayer.TableDesigner
{
NewTableInfo = tableInfo,
ViewModel = this.GetTableViewModel(tableInfo),
View = GetDesignerViewInfo(tableInfo)
View = GetDesignerViewInfo(tableInfo),
Metadata = this.GetMetadata(tableInfo)
});
});
}
@@ -171,6 +173,7 @@ namespace Microsoft.SqlTools.ServiceLayer.TableDesigner
var generatePreviewReportResult = new GeneratePreviewReportResult();
generatePreviewReportResult.Report = report;
generatePreviewReportResult.MimeType = "text/markdown";
generatePreviewReportResult.Metadata = this.GetMetadata(tableInfo);
await requestContext.SendResult(generatePreviewReportResult);
});
}
@@ -1298,9 +1301,9 @@ namespace Microsoft.SqlTools.ServiceLayer.TableDesigner
private Dac.TableDesigner CreateTableDesigner(TableInfo tableInfo)
{
var connectinStringbuilder = new SqlConnectionStringBuilder(tableInfo.ConnectionString);
connectinStringbuilder.InitialCatalog = tableInfo.Database;
var connectionString = connectinStringbuilder.ToString();
var connectionStringbuilder = new SqlConnectionStringBuilder(tableInfo.ConnectionString);
connectionStringbuilder.InitialCatalog = tableInfo.Database;
var connectionString = connectionStringbuilder.ToString();
var tableDesigner = new Dac.TableDesigner(connectionString, tableInfo.AccessToken, tableInfo.Schema, tableInfo.Name, tableInfo.IsNewTable);
this.idTableMap[tableInfo.Id] = tableDesigner;
return tableDesigner;
@@ -1319,6 +1322,18 @@ namespace Microsoft.SqlTools.ServiceLayer.TableDesigner
}
}
private Dictionary<string, string> GetMetadata(TableInfo tableInfo)
{
var tableDesigner = this.GetTableDesigner(tableInfo);
var metadata = new Dictionary<string, string>()
{
{ "IsEdge", tableDesigner.IsEdge().ToString() },
{ "IsNode", tableDesigner.IsNode().ToString() },
{ "IsSystemVersioned", tableDesigner.IsSystemVersioned().ToString() }
};
return metadata;
}
/// <summary>
/// Disposes the table designer Service
/// </summary>