public SqlServerDatabaseContextMenu(DatabaseMenuCommandParameters databaseMenuCommandParameters, ExplorerToolWindow parent) { var itemBuilder = new DatabaseContextMenuItems(); var dcmd = new SqlServerDatabaseMenuCommandsHandler(parent); var dbcmd = new DatabaseMenuCommandsHandler(parent); var isSqlCe40Installed = DataConnectionHelper.IsV40Installed(); if (databaseMenuCommandParameters.DatabaseInfo.DatabaseType != DatabaseType.SQLServer) { return; } if (SqlCeToolboxPackage.IsVsExtension) { Items.Add(BuildScriptServerDatabaseGraphMenuItem(databaseMenuCommandParameters, dcmd)); } if (SqlCeToolboxPackage.IsVsExtension) { Items.Add(new Separator()); } var scriptDatabaseRootMenuItem = new MenuItem { Header = "Script Database", Icon = ImageHelper.GetImageFromResource("../resources/script_16xLG.png"), }; var toolTip = new ToolTip { Content = "Generate a SQL Server Compact compatible database script from SQL Server 2005+" }; // Database scripting items var scriptDatabaseCommandBinding = new CommandBinding(DatabaseMenuCommands.DatabaseCommand, dcmd.ScriptServerDatabase); scriptDatabaseRootMenuItem.Items.Add(itemBuilder.BuildScriptDatabaseSchemaMenuItem(databaseMenuCommandParameters, toolTip, scriptDatabaseCommandBinding)); scriptDatabaseRootMenuItem.Items.Add(itemBuilder.BuildScriptDatabaseDataMenuItem(databaseMenuCommandParameters, toolTip, scriptDatabaseCommandBinding)); scriptDatabaseRootMenuItem.Items.Add(itemBuilder.BuildScriptDatabaseSchemaDataMenuItem(databaseMenuCommandParameters, toolTip, scriptDatabaseCommandBinding)); scriptDatabaseRootMenuItem.Items.Add(itemBuilder.BuildScriptDatabaseSchemaDataSqLiteMenuItem(databaseMenuCommandParameters, toolTip, scriptDatabaseCommandBinding)); scriptDatabaseRootMenuItem.Items.Add(BuildScriptDatabaseSchemaSqLiteMenuItem(databaseMenuCommandParameters, toolTip, scriptDatabaseCommandBinding)); scriptDatabaseRootMenuItem.Items.Add(itemBuilder.BuildScriptDatabaseSchemaDataBlobMenuItem(databaseMenuCommandParameters, toolTip, scriptDatabaseCommandBinding)); Items.Add(scriptDatabaseRootMenuItem); Items.Add(new Separator()); #if SSMS #else if (SqlCeToolboxPackage.VsSupportsEfCore()) { Items.Add(itemBuilder.BuildEfCoreModelMenuItem(databaseMenuCommandParameters, dbcmd)); } #endif #if VS2010 #else if (SqlCeToolboxPackage.VsSupportsEf6()) { Items.Add(BuildScriptEfPocoDacPacMenuItem(databaseMenuCommandParameters, dcmd)); } #endif if (SqlCeToolboxPackage.IsVsExtension) { Items.Add(new Separator()); } Items.Add(BuildExportServerMenuItem(databaseMenuCommandParameters, dcmd, isSqlCe40Installed)); Items.Add(BuildExportServerToLiteMenuItem(databaseMenuCommandParameters, dcmd)); if (!databaseMenuCommandParameters.DatabaseInfo.FromServerExplorer) { Items.Add(new Separator()); Items.Add(itemBuilder.BuildRemoveConnectionMenuItem(databaseMenuCommandParameters, dbcmd)); } }
public SqlCeDatabaseContextMenu(DatabaseMenuCommandParameters databaseMenuCommandParameters, ExplorerToolWindow parent) { var itemBuilder = new DatabaseContextMenuItems(); var dbType = databaseMenuCommandParameters.DatabaseInfo.DatabaseType; if (!(dbType == DatabaseType.SQLCE35 || dbType == DatabaseType.SQLCE40)) { return; } var dcmd = new DatabaseMenuCommandsHandler(parent); var cecmd = new SqlCeDatabaseMenuCommandsHandler(parent); Items.Add(itemBuilder.BuildShowSqlEditorMenuItem(databaseMenuCommandParameters, dcmd)); Items.Add(itemBuilder.BuildCreateTableMenuItem(databaseMenuCommandParameters, dcmd)); Items.Add(new Separator()); var scriptDatabaseRootMenuItem = new MenuItem { Header = "Script Database", Icon = ImageHelper.GetImageFromResource("../resources/script_16xLG.png"), }; var toolTip = new ToolTip { Content = "Generate a SQL Server Compact/SQLite compatible database script" }; // Database scripting items var scriptDatabaseCommandBinding = new CommandBinding(DatabaseMenuCommands.DatabaseCommand, dcmd.ScriptDatabase); scriptDatabaseRootMenuItem.Items.Add(itemBuilder.BuildScriptDatabaseSchemaMenuItem(databaseMenuCommandParameters, toolTip, scriptDatabaseCommandBinding)); scriptDatabaseRootMenuItem.Items.Add(itemBuilder.BuildScriptDatabaseSchemaDataMenuItem(databaseMenuCommandParameters, toolTip, scriptDatabaseCommandBinding)); scriptDatabaseRootMenuItem.Items.Add(BuildScriptAzureSchemaDataMenuItem(databaseMenuCommandParameters, scriptDatabaseCommandBinding)); scriptDatabaseRootMenuItem.Items.Add(itemBuilder.BuildScriptDatabaseSchemaDataSqLiteMenuItem(databaseMenuCommandParameters, toolTip, scriptDatabaseCommandBinding)); scriptDatabaseRootMenuItem.Items.Add(itemBuilder.BuildScriptDatabaseSchemaDataBlobMenuItem(databaseMenuCommandParameters, toolTip, scriptDatabaseCommandBinding)); scriptDatabaseRootMenuItem.Items.Add(itemBuilder.BuildScriptDatabaseDataMenuItem(databaseMenuCommandParameters, toolTip, scriptDatabaseCommandBinding)); scriptDatabaseRootMenuItem.Items.Add(BuildScriptDatabaseDataForServerMenuItem(databaseMenuCommandParameters, scriptDatabaseCommandBinding)); scriptDatabaseRootMenuItem.Items.Add(BuildScriptDatabaseDiffMenuItem(databaseMenuCommandParameters, dcmd)); //End Database scripting items Items.Add(scriptDatabaseRootMenuItem); Items.Add(new Separator()); var maintenanceMenuItem = new MenuItem { Header = "Maintenance", Icon = ImageHelper.GetImageFromResource("../resources/Hammer_Builder_16xLG.png"), }; maintenanceMenuItem.Items.Add(BuildPwdMenuItem(databaseMenuCommandParameters, cecmd)); var shrinkMenuItem = itemBuilder.BuildShrinkMenuItem(databaseMenuCommandParameters, dcmd); maintenanceMenuItem.Items.Add(shrinkMenuItem); var compactMenuItem = itemBuilder.BuildCompactMenuItem(databaseMenuCommandParameters, dcmd); maintenanceMenuItem.Items.Add(compactMenuItem); maintenanceMenuItem.Items.Add(BuildVerifyMenuItem(databaseMenuCommandParameters, cecmd)); maintenanceMenuItem.Items.Add(BuildRepairDeleteMenuItem(databaseMenuCommandParameters, cecmd)); maintenanceMenuItem.Items.Add(BuildRepairRecoverAllMenuItem(databaseMenuCommandParameters, cecmd)); maintenanceMenuItem.Items.Add(BuildRepairRecoverPossibleMenuItem(databaseMenuCommandParameters, cecmd)); Items.Add(maintenanceMenuItem); Items.Add(new Separator()); Items.Add(itemBuilder.BuildScriptDatabaseExportMenuItem(databaseMenuCommandParameters, dcmd)); if (dbType == DatabaseType.SQLCE35 && Helpers.RepositoryHelper.IsV40Installed()) { Items.Add(BuildScriptUpgradeMenuItem(databaseMenuCommandParameters, cecmd)); } Items.Add(new Separator()); if (SqlCeToolboxPackage.IsVsExtension) { Items.Add(itemBuilder.BuildScriptDatabaseGraphMenuItem(databaseMenuCommandParameters, dcmd)); } Items.Add(itemBuilder.BuildDocDatabaseMenuItem(databaseMenuCommandParameters, dcmd)); Items.Add(new Separator()); var generateCodeRootMenuItem = new MenuItem { Header = "Generate Code", Icon = ImageHelper.GetImageFromResource("../resources/Schema_16xLG.png"), }; #if SSMS #else var scriptDcCommandBinding = new CommandBinding(DatabaseMenuCommands.DatabaseCommand, cecmd.GenerateDataContextInProject); generateCodeRootMenuItem.Items.Add(BuildScriptDcMenuItem(databaseMenuCommandParameters, scriptDcCommandBinding)); generateCodeRootMenuItem.Items.Add(BuildScriptWpdcMenuItem(databaseMenuCommandParameters, scriptDcCommandBinding, dbType)); generateCodeRootMenuItem.Items.Add(new Separator()); #endif var syncFxRootMenuItem = new MenuItem { Header = "Sync Framework Tools", Icon = ImageHelper.GetImageFromResource("../resources/Synchronize_16xLG.png"), }; var isSyncFxInstalled = DataConnectionHelper.IsSyncFx21Installed(); syncFxRootMenuItem.Items.Add(BuildSyncFxProvisionMenuItem(databaseMenuCommandParameters, cecmd, dbType, isSyncFxInstalled)); syncFxRootMenuItem.Items.Add(BuildSyncFxDeprovisionMenuItem(databaseMenuCommandParameters, cecmd, dbType, isSyncFxInstalled)); syncFxRootMenuItem.Items.Add(BuildSyncFxGenerateSnapshotMenuItem(databaseMenuCommandParameters, cecmd, dbType, isSyncFxInstalled)); generateCodeRootMenuItem.Items.Add(BuildSyncFxMenuItem(databaseMenuCommandParameters, cecmd, dbType, isSyncFxInstalled)); generateCodeRootMenuItem.Items.Add(syncFxRootMenuItem); if (SqlCeToolboxPackage.IsVsExtension) { Items.Add(generateCodeRootMenuItem); } if (SqlCeToolboxPackage.IsVsExtension) { Items.Add(new Separator()); } Items.Add(BuildAddDescriptionMenuItem(databaseMenuCommandParameters, dcmd)); Items.Add(itemBuilder.BuildGenerateInfoMenuItem(databaseMenuCommandParameters, dcmd)); Items.Add(new Separator()); Items.Add(BuildCopyConnectionMenuItem(databaseMenuCommandParameters, cecmd)); Items.Add(itemBuilder.BuildRemoveConnectionMenuItem(databaseMenuCommandParameters, dcmd)); }