Add SDK sql project template (#18058)

* add sdk style project template

* update description and order

* update template

* update template and add link

* remove ToolsVersion and xmlns from project node

* update template name to SQL Database (SDK)
This commit is contained in:
Kim Santiago
2022-01-19 10:08:47 -08:00
committed by GitHub
parent 8378e89639
commit 967cd2b102
7 changed files with 54 additions and 4 deletions

View File

@@ -32,6 +32,10 @@ export const edgeSqlDatabaseProjectTypeId = 'SqlDbEdgeProj';
export const edgeProjectTypeDisplayName = localize('edgeProjectTypeDisplayName', "SQL Edge");
export const edgeProjectTypeDescription = localize('edgeProjectTypeDescription', "Start with the core pieces to develop and publish schemas for SQL Edge");
export const emptySqlDatabaseSdkProjectTypeId = 'EmptySqlDbSdkProj';
export const emptySdkProjectTypeDisplayName = localize('emptySdkProjectTypeDisplayName', "SQL Database (SDK)");
export const emptySdkProjectTypeDescription = localize('emptySdkProjectTypeDescription', "Develop and publish schemas for SQL databases with Microsoft.Build.Sql (preview), starting from an empty SDK-style project.");
// Dashboard
export const addItemAction = localize('addItemAction', "Add Item");
export const schemaCompareAction = localize('schemaCompareAction', "Schema Compare");
@@ -87,6 +91,7 @@ export const schemaObjectType = localize('schemaObjectType', "Schema/Object Type
export const defaultProjectNameStarter = localize('defaultProjectNameStarter', "DatabaseProject");
export const location = localize('location', "Location");
export const reloadProject = localize('reloadProject', "Would you like to reload your database project?");
export const learnMore = localize('learnMore', "Learn More");
export function newObjectNamePrompt(objectType: string) { return localize('newObjectNamePrompt', 'New {0} name:', objectType); }
export function deleteConfirmation(toDelete: string) { return localize('deleteConfirmation', "Are you sure you want to delete {0}?", toDelete); }
export function deleteConfirmationContents(toDelete: string) { return localize('deleteConfirmationContents', "Are you sure you want to delete {0} and all of its contents?", toDelete); }

View File

@@ -173,7 +173,7 @@ export class ProjectsController {
'PROJECT_DSP': creationParams.targetPlatform ? constants.targetPlatformToVersion.get(creationParams.targetPlatform)! : constants.defaultDSP
};
let newProjFileContents = templates.macroExpansion(templates.newSqlProjectTemplate, macroDict);
let newProjFileContents = creationParams.projectTypeId === constants.emptySqlDatabaseSdkProjectTypeId ? templates.macroExpansion(templates.newSdkSqlProjectTemplate, macroDict) : templates.macroExpansion(templates.newSqlProjectTemplate, macroDict);
let newProjFileName = creationParams.newProjName;

View File

@@ -36,6 +36,17 @@ export class SqlDatabaseProjectProvider implements dataworkspace.IProjectProvide
*/
get supportedProjectTypes(): dataworkspace.IProjectType[] {
return [{
id: constants.emptySqlDatabaseSdkProjectTypeId,
projectFileExtension: constants.sqlprojExtension.replace(/\./g, ''),
displayName: constants.emptySdkProjectTypeDisplayName,
description: constants.emptySdkProjectTypeDescription,
icon: IconPathHelper.colorfulSqlProject,
targetPlatforms: Array.from(constants.targetPlatformToVersion.keys()),
defaultTargetPlatform: constants.defaultTargetPlatform,
linkDisplayValue: constants.learnMore,
linkLocation: 'https://github.com/microsoft/DacFx/tree/main/src/Microsoft.Build.Sql'
},
{
id: constants.emptySqlDatabaseProjectTypeId,
projectFileExtension: constants.sqlprojExtension.replace(/\./g, ''),
displayName: constants.emptyProjectTypeDisplayName,

View File

@@ -8,6 +8,7 @@ import * as constants from '../common/constants';
import { promises as fs } from 'fs';
export let newSqlProjectTemplate: string;
export let newSdkSqlProjectTemplate: string;
// Object types
@@ -51,6 +52,7 @@ export async function loadTemplates(templateFolderPath: string) {
await Promise.all([
Promise.resolve(newSqlProjectTemplate = await loadTemplate(templateFolderPath, 'newSqlProjectTemplate.xml')),
Promise.resolve(newSdkSqlProjectTemplate = await loadTemplate(templateFolderPath, 'newSdkSqlProjectTemplate.xml')),
loadObjectTypeInfo(script, constants.scriptFriendlyName, templateFolderPath, 'newTsqlScriptTemplate.sql'),
loadObjectTypeInfo(table, constants.tableFriendlyName, templateFolderPath, 'newTsqlTableTemplate.sql'),
loadObjectTypeInfo(view, constants.viewFriendlyName, templateFolderPath, 'newTsqlViewTemplate.sql'),