├── .gitignore ├── LICENSE ├── License.md ├── README.md ├── release └── SSDTDevPack.VSPackage.vsix └── src ├── Common └── src │ ├── SSDTDevPack.Common │ ├── Clippy │ │ ├── ClippyGlyphFactory.cs │ │ ├── ClippyGlyphFactoryProvider.cs │ │ ├── ClippyOperation.cs │ │ ├── ClippyReplacementOperation.cs │ │ ├── ClippyReplacementOperations.cs │ │ ├── ClippySettings.cs │ │ ├── ClippyTag.cs │ │ ├── ClippyTagger.cs │ │ ├── ClippyTaggerProvider.cs │ │ ├── MainWindow.xaml │ │ ├── MainWindow.xaml.cs │ │ ├── MenuItem.xaml │ │ ├── MenuItem.xaml.cs │ │ ├── Operations │ │ │ ├── ClippyOperationBuilder.cs │ │ │ ├── DeleteChunkerOperation.cs │ │ │ ├── InequalityReWriteOperation.cs │ │ │ ├── IsNullReWriteOperation.cs │ │ │ ├── OrdinalOrderByReWriteOperation.cs │ │ │ ├── QueryCostOperations.cs │ │ │ ├── ReWriterOperation.cs │ │ │ └── TableNameCorrectCaser.cs │ │ ├── OperationsBuilder.cs │ │ └── TagStore.cs │ ├── CodeCOverage │ │ ├── CodeCoverageMap.cs │ │ ├── CodeCoverageStore.cs │ │ ├── CoveredStatement.cs │ │ ├── DatabaseGateway.cs │ │ ├── ExtendedEventDataDataReader.cs │ │ └── Ui │ │ │ ├── CodeCoverageWindow.xaml │ │ │ └── CodeCoverageWindow.xaml.cs │ ├── CodeExtractor.cs │ ├── ConnectionDialog │ │ ├── LabelledTextbox.xaml │ │ ├── LabelledTextbox.xaml.cs │ │ ├── SqlConnectionDialog.xaml │ │ ├── SqlConnectionDialog.xaml.cs │ │ └── WatermarkService.cs │ ├── ConstraintNamer.cs │ ├── Dac │ │ ├── ColumnDescriptor.cs │ │ ├── DacpacPath.cs │ │ ├── LiteralConverter.cs │ │ ├── Model.cs │ │ ├── ObjectIdentifierExtensions.cs │ │ ├── ProcedureRepository.cs │ │ ├── TableDescriptor.cs │ │ └── TableRepository.cs │ ├── Enumerators │ │ ├── ProjectEnumerator.cs │ │ ├── ProjectItemEnumerator.cs │ │ ├── ProjectType.cs │ │ ├── StatementEnumerator.cs │ │ └── tSQLt │ │ │ └── TestClassEnumerator.cs │ ├── Key.snk │ ├── KeywordCaser.cs │ ├── Log.cs │ ├── Merge │ │ ├── 069085-black-paint-splatter-icon-alphanumeric-letter-m.png │ │ ├── MergeDescriptor │ │ │ ├── Merge.cs │ │ │ └── MergeOptions.cs │ │ ├── Parsing │ │ │ ├── MergeStatementFactory.cs │ │ │ ├── MergeStatementParser.cs │ │ │ └── MergeStatementRepository.cs │ │ └── UI │ │ │ ├── AddTableDialog.Designer.cs │ │ │ ├── AddTableDialog.cs │ │ │ ├── AddTableDialog.resx │ │ │ ├── ConnectDialog.Designer.cs │ │ │ ├── ConnectDialog.cs │ │ │ ├── ConnectDialog.resx │ │ │ ├── ImportMultipleTablesDialog.Designer.cs │ │ │ ├── ImportMultipleTablesDialog.cs │ │ │ ├── ImportMultipleTablesDialog.resx │ │ │ ├── ImportOverwriteTable.Designer.cs │ │ │ ├── ImportOverwriteTable.cs │ │ │ ├── ImportOverwriteTable.resx │ │ │ ├── ImportSingleTableDialog.Designer.cs │ │ │ ├── ImportSingleTableDialog.cs │ │ │ ├── ImportSingleTableDialog.resx │ │ │ ├── MainWindow.xaml │ │ │ ├── MainWindow.xaml.cs │ │ │ ├── TablePage.xaml │ │ │ ├── TablePage.xaml.cs │ │ │ ├── UIProperties.cs │ │ │ └── UiSettings.cs │ ├── ProjectItems │ │ ├── Extensions.cs │ │ └── ScriptDom │ │ │ ├── Quote.cs │ │ │ └── ScriptParser.cs │ ├── ProjectVersion │ │ └── VersionDetector.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── QueryCosts │ │ ├── DocumentScriptCosters.cs │ │ ├── Highlighter │ │ │ ├── HighlightWordFormatDefinition.cs │ │ │ ├── HighlightWordTag.cs │ │ │ ├── HighlightWordTagger.cs │ │ │ ├── HighlightWordTaggerProvider.cs │ │ │ ├── LowlightWordFormatDefinition.cs │ │ │ └── LowlightWordTag.cs │ │ ├── QueryCostRepository.cs │ │ └── ScriptCoster.cs │ ├── QuickDeploy │ │ └── QuickDeployer.cs │ ├── Rewriter │ │ ├── ChunkDeletesRewriter.cs │ │ ├── DuplicateIndexFinder.cs │ │ ├── NonSargableRewrites.cs │ │ ├── OrderByOrdinalRewrites.cs │ │ ├── Replacements.cs │ │ └── TableReferenceRewriter.cs │ ├── SSDTDevPack.Common.csproj │ ├── ScriptDom │ │ └── ProcedureVisitor.cs │ ├── Settings │ │ └── SavedSettings.cs │ ├── SolutionBrowser │ │ ├── SolutionBrowser.cs │ │ ├── SolutionBrowserForm.Designer.cs │ │ ├── SolutionBrowserForm.cs │ │ ├── SolutionBrowserForm.resx │ │ ├── wpfSolutionBrowser.xaml │ │ └── wpfSolutionBrowser.xaml.cs │ ├── Ui │ │ ├── LabelWithProgressIndicator.xaml │ │ └── LabelWithProgressIndicator.xaml.cs │ ├── UserMessages │ │ └── OutputPane.cs │ ├── VSPackage │ │ ├── DocumentExtensions.cs │ │ ├── IVsServiceProvider.cs │ │ └── ServiceProvider.cs │ ├── app.config │ ├── packages.config │ └── tSQLtStubber │ │ ├── Parameter.cs │ │ ├── ParametersHelper.cs │ │ ├── ProcedureBuilder.cs │ │ ├── ProcedureVisitor.cs │ │ ├── SchemaBuilder.cs │ │ ├── ScriptBuilder.cs │ │ └── TestBuilder.cs │ └── SSDTDevPack.Logging │ ├── Key.snk │ ├── Properties │ └── AssemblyInfo.cs │ ├── SSDTDevPack.Logging.csproj │ └── packages.config ├── Lib ├── DacFxStronglyTypedModel.dll ├── DacFxStronglyTypedModel.pdb ├── Microsoft.SqlServer.Dac.Extensions.xml └── Microsoft.SqlServer.Dac.xml ├── Merge └── src │ ├── SSDTDevPack.Indexes │ ├── Key.snk │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── SSDTDevPack.Rewriter.csproj │ ├── app.config │ └── packages.config │ ├── SSDTDevPack.Merge │ ├── 069085-black-paint-splatter-icon-alphanumeric-letter-m readme.txt │ ├── 069085-black-paint-splatter-icon-alphanumeric-letter-m.ico │ ├── Key.snk │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── SSDTDevPack.Merge.csproj │ ├── SSDTDevPack.Merge.sln │ ├── app.config │ └── packages.config │ └── SSDTDevPack.VSPackage │ ├── CheckableCommand.cs │ ├── CodeCoverageToolWindow.cs │ ├── GlobalSuppressions.cs │ ├── Guids.cs │ ├── Key.snk │ ├── LICENSE │ ├── MergeToolWindow.cs │ ├── MyControl.xaml │ ├── MyControl.xaml.cs │ ├── PkgCmdID.cs │ ├── Properties │ └── AssemblyInfo.cs │ ├── Resources.Designer.cs │ ├── Resources.resx │ ├── Resources │ ├── 069085-black-paint-splatter-icon-alphanumeric-letter-m.ico │ ├── 069085-black-paint-splatter-icon-alphanumeric-letter-m.png │ ├── Images.png │ └── Package.ico │ ├── SSDTDevPack.VSPackage.csproj │ ├── SSDTDevPack.VSPackage.vsct │ ├── SSDTDevPack.VSPackagePackage.cs │ ├── VSPackage.resx │ ├── app.config │ ├── packages.config │ └── source.extension.vsixmanifest ├── NameConstraints └── src │ └── SSDTDevPack.NameConstraints │ ├── Key.snk │ ├── Properties │ └── AssemblyInfo.cs │ ├── SSDTDevPack.NameConstraints.csproj │ ├── app.config │ └── packages.config ├── SSDTDevPack.CCover ├── Key.snk ├── Properties │ └── AssemblyInfo.cs ├── SSDTDevPack.CCover.csproj ├── app.config └── packages.config ├── SSDTDevPack.Clippy ├── Key.snk ├── Properties │ └── AssemblyInfo.cs ├── SSDTDevPack.Clippy.csproj ├── app.config └── packages.config ├── SSDTDevPack.CodeCoverage ├── App.config ├── Program.cs ├── Properties │ └── AssemblyInfo.cs ├── SSDTDevPack.CodeCoverage.csproj └── packages.config ├── SSDTDevPack.Extraction ├── Key.snk ├── Properties │ └── AssemblyInfo.cs ├── SSDTDevPack.Extraction.csproj ├── app.config └── packages.config ├── SSDTDevPack.Formatting ├── Key.snk ├── Properties │ └── AssemblyInfo.cs ├── SSDTDevPack.Formatting.csproj ├── app.config └── packages.config ├── SSDTDevPack.QueryCosts ├── Key.snk ├── Properties │ └── AssemblyInfo.cs ├── SSDTDevPack.QueryCosts.csproj ├── app.config └── packages.config ├── SSDTDevPack.QuickDeploy ├── Key.snk ├── Properties │ └── AssemblyInfo.cs ├── SSDTDevPack.QuickDeploy.csproj ├── app.config └── packages.config ├── Test ├── Common │ ├── SSDTDevPack.Common.IntegrationTests │ │ ├── Dacpac │ │ │ └── DacpacColumnProvider.cs │ │ ├── Directories.cs │ │ ├── DteVsPackageProvider.cs │ │ ├── Enumerators │ │ │ ├── ProjectEnumerator.cs │ │ │ ├── ProjectItemEnumerator.cs │ │ │ └── tSQLt │ │ │ │ └── TestClassEnumeratorTests.cs │ │ ├── IOleMessageFilter.cs │ │ ├── MergeStatementRepository │ │ │ └── MergeStatementRepositoryTests.cs │ │ ├── MergeWriter │ │ │ └── MergeWriterTests.cs │ │ ├── MessageFilter.cs │ │ ├── Properties │ │ │ └── AssemblyInfo.cs │ │ ├── SSDTDevPack.Common.IntegrationTests.csproj │ │ ├── ScriptParser │ │ │ └── ScriptParserTests.cs │ │ ├── app.config │ │ ├── nlog.config │ │ └── packages.config │ ├── SSDTDevPack.Common.UnitTests │ │ ├── DeleteChinkerReWriter.cs │ │ ├── InequalityRewriterTests.cs │ │ ├── NonSargableReWriteTests.cs │ │ ├── OrderByOrdinalRewritesTests.cs │ │ ├── Properties │ │ │ └── AssemblyInfo.cs │ │ ├── SSDTDevPack.Common.UnitTests.csproj │ │ ├── app.config │ │ └── packages.config │ ├── SampleSolutions │ │ └── NestedProjects │ │ │ ├── Nested │ │ │ ├── ABC │ │ │ │ ├── DEF │ │ │ │ │ ├── BadImport.sql │ │ │ │ │ ├── GoodImport.sql │ │ │ │ │ ├── Script.Included.sql │ │ │ │ │ ├── Script.NotIncluded.sql │ │ │ │ │ ├── Script.PostDeploy.sql │ │ │ │ │ ├── Script.Predeploy.sql │ │ │ │ │ ├── aaaa.sql │ │ │ │ │ └── f │ │ │ │ │ │ ├── f.sql │ │ │ │ │ │ ├── test f does something.sql │ │ │ │ │ │ └── test f does something_1.sql │ │ │ │ ├── f.sql │ │ │ │ ├── f │ │ │ │ │ └── test f does something.sql │ │ │ │ └── tSQLtTests.sql │ │ │ ├── Nested.sln │ │ │ ├── Nested.sqlproj │ │ │ ├── Tests │ │ │ │ └── fTests │ │ │ │ │ ├── fTests.sql │ │ │ │ │ └── test f does something.sql │ │ │ └── TheTable.sql │ │ │ └── Nested2 │ │ │ ├── Nested2.sqlproj │ │ │ └── Script.PreDeployment1.sql │ └── SqlConnectionTest │ │ ├── App.config │ │ ├── Form1.Designer.cs │ │ ├── Form1.cs │ │ ├── Form1.resx │ │ ├── Program.cs │ │ ├── Properties │ │ ├── AssemblyInfo.cs │ │ ├── Resources.Designer.cs │ │ ├── Resources.resx │ │ ├── Settings.Designer.cs │ │ └── Settings.settings │ │ └── SqlConnectionTest.csproj ├── Merge │ ├── SSDTDevPack.Merge.UnitTests │ │ ├── Class1.cs │ │ ├── Properties │ │ │ └── AssemblyInfo.cs │ │ ├── SSDTDevPack.Merge.UnitTests.csproj │ │ └── packages.config │ └── WinFormHost.Merge │ │ ├── App.config │ │ ├── Form1.Designer.cs │ │ ├── Form1.cs │ │ ├── Form1.resx │ │ ├── Program.cs │ │ ├── Properties │ │ ├── AssemblyInfo.cs │ │ ├── Resources.Designer.cs │ │ ├── Resources.resx │ │ ├── Settings.Designer.cs │ │ └── Settings.settings │ │ └── WinFormHost.Merge.csproj ├── NameConstraints │ ├── NameConstraints.IntegrationTests │ │ ├── Key.snk │ │ ├── NameConstraints.IntegrationTests.csproj │ │ ├── Names.cs │ │ ├── Properties │ │ │ └── AssemblyInfo.cs │ │ ├── app.config │ │ └── packages.config │ └── ProjectWithConstraints │ │ ├── ProjectWithConstraints.sqlproj │ │ └── TableOne.sql └── QueryCost │ └── SSDTDevPack.QueryCosts.UnitTests │ ├── Class1.cs │ ├── Properties │ └── AssemblyInfo.cs │ ├── SSDTDevPack.QueryCosts.UnitTests.csproj │ ├── app.config │ └── packages.config ├── TextClassifier ├── Class1.cs ├── Properties │ └── AssemblyInfo.cs └── TextClassifier.csproj └── tSQLtStubber └── SSDTDevPack.tSQLtStubber ├── Key.snk ├── Parameter.cs ├── ParametersHelper.cs ├── ProcedureBuilder.cs ├── ProcedureVisitor.cs ├── Properties └── AssemblyInfo.cs ├── SSDTDevPack.tSQLtStubber.csproj ├── SchemaBuilder.cs ├── ScriptBuilder.cs ├── TestBuilder.cs ├── app.config └── packages.config /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Ed Elliott 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /License.md: -------------------------------------------------------------------------------- 1 | ## The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Ed Elliott 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # SSDT-DevPack 2 | 3 | [![Join the chat at https://gitter.im/GoEddie/SSDT-DevPack](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/GoEddie/SSDT-DevPack?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) 4 | 5 | It is basically a collection of tools that make developing in for SQL Server in SSDT better or easier. If anyone has any ideas for a tool that they would find useful please feel free to fork it on github and add it. 6 | 7 | For full details of what this is see: 8 | 9 | ## For the latest release grab it from: 10 | 11 | For help open an issue or use the gitter room. 12 | 13 | 14 | ## Features 15 | 16 | The first one is MergeUi which basically (as you might imagine) puts a gui around merger statements in post deployment scripts to make it simple to deploy static or reference data with an SSDT project 17 | 18 | - Re-write unnamed primary keys into named table constraints 19 | - Create tSQLt schemas (classes) including the extended property everyone always forgets 20 | - Take a stored procedure or tvf and create a tSQLt test for it including faking every take in the procedure and creating the parameters needed for the procedure and calling it 21 | - When developing a stored procedure (or tvf) configure a connection to a database with realistic statistics and have high costing queries hightlighted so it is easy to see queries that will cause issues (not a 100% catch all obviously) 22 | - Re-write non sargable isnulls into sargable searches 23 | - T-Sql Clippy (automatic re-writes, != into <>, name ordinals in order by etc) 24 | 25 | ## License 26 | [MIT](/License.md) 27 | -------------------------------------------------------------------------------- /release/SSDTDevPack.VSPackage.vsix: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GoEddie/SSDT-DevPack/0915f2acf4add5482221ec6c8dd55c8ca34d0c52/release/SSDTDevPack.VSPackage.vsix -------------------------------------------------------------------------------- /src/Common/src/SSDTDevPack.Common/Clippy/ClippyGlyphFactory.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Diagnostics; 4 | using System.Linq; 5 | using System.Runtime.InteropServices; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Media; 9 | using System.Windows.Shapes; 10 | using Microsoft.VisualStudio.Text.Editor; 11 | using Microsoft.VisualStudio.Text.Formatting; 12 | 13 | namespace SSDTDevPack.Clippy 14 | { 15 | 16 | 17 | /// 18 | /// This class implements IGlyphFactory, which provides the visual 19 | /// element that will appear in the glyph margin. 20 | /// 21 | internal class ClippyGlyphFactory : IGlyphFactory 22 | { 23 | 24 | 25 | public UIElement GenerateGlyph(IWpfTextViewLine line, IGlyphTag tag) 26 | { 27 | 28 | // Ensure we can draw a glyph for this marker. 29 | if (tag == null || !(tag is ClippyTag)) 30 | { 31 | return null; 32 | } 33 | 34 | 35 | 36 | var clippy = tag as ClippyTag; 37 | // Debug.WriteLine("Creating Glyph: " + clippy.GetDefinition().Line); 38 | //Debug.WriteLine("Drawing Glyph: {0} - {1}", clippy.GetDefinition().Line, clippy.GetDefinition().Type); 39 | 40 | var grid = clippy.GetEllipses(); 41 | //grid.SetValue(Grid.ZIndexProperty, 999); 42 | ////grid.AddHandler(new RoutedEvent().HandlerType == ) 43 | //grid.AddHandler(Grid.ContextMenuOpeningEvent, new RoutedEventHandler(OnOpen)); 44 | //grid.AddHandler(Grid.PreviewMouseRightButtonUpEvent, new RoutedEventHandler(OnOpen)); 45 | 46 | 47 | 48 | return grid; 49 | 50 | } 51 | 52 | public void OnOpen(object sender, RoutedEventArgs e) 53 | { 54 | MessageBox.Show("does this fire?"); 55 | } 56 | 57 | 58 | 59 | } 60 | } -------------------------------------------------------------------------------- /src/Common/src/SSDTDevPack.Common/Clippy/ClippyOperation.cs: -------------------------------------------------------------------------------- 1 | namespace SSDTDevPack.Clippy 2 | { 3 | public abstract class ClippyOperation 4 | { 5 | public abstract void DoOperation(GlyphDefinition glyph); 6 | } 7 | } -------------------------------------------------------------------------------- /src/Common/src/SSDTDevPack.Common/Clippy/ClippyReplacementOperation.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Microsoft.VisualStudio.Text; 3 | using SSDTDevPack.Common.UserMessages; 4 | using SSDTDevPack.Rewriter; 5 | 6 | namespace SSDTDevPack.Clippy 7 | { 8 | class ClippyReplacementOperation : ClippyOperation 9 | { 10 | private ITextSnapshot _snapshot; 11 | private Replacements _replacement; 12 | 13 | public ClippyReplacementOperation(Replacements replacement) 14 | { 15 | _replacement = replacement; 16 | } 17 | 18 | public void Configure(ITextSnapshot snapshot) 19 | { 20 | _snapshot = snapshot; 21 | } 22 | 23 | 24 | public override void DoOperation(GlyphDefinition glyph) 25 | { 26 | try 27 | { 28 | var span = _snapshot.CreateTrackingSpan(_replacement.OriginalOffset, _replacement.OriginalLength, SpanTrackingMode.EdgeNegative).GetSpan(_snapshot); 29 | 30 | if (span.GetText() != _replacement.Original) 31 | return; 32 | 33 | var newSpan = span.Snapshot.CreateTrackingSpan(span.Start, _replacement.OriginalLength, SpanTrackingMode.EdgeNegative); 34 | 35 | _snapshot.TextBuffer.Replace(newSpan.GetSpan(newSpan.TextBuffer.CurrentSnapshot), _replacement.Replacement); 36 | 37 | glyph.Tag.Tagger.Reset(); 38 | } 39 | catch (Exception e) 40 | { 41 | OutputPane.WriteMessage("error unable to do replacement : {0}", e); 42 | } 43 | } 44 | } 45 | } -------------------------------------------------------------------------------- /src/Common/src/SSDTDevPack.Common/Clippy/ClippyReplacementOperations.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using Microsoft.VisualStudio.Text; 4 | using SSDTDevPack.Common.UserMessages; 5 | using SSDTDevPack.Rewriter; 6 | 7 | namespace SSDTDevPack.Clippy 8 | { 9 | class ClippyReplacementOperations : ClippyOperation 10 | { 11 | private ITextSnapshot _snapshot; 12 | private readonly List _replacements; 13 | 14 | public ClippyReplacementOperations(List replacement) 15 | { 16 | _replacements = replacement; 17 | } 18 | 19 | public void Configure(ITextSnapshot snapshot) 20 | { 21 | _snapshot = snapshot; 22 | } 23 | 24 | public override void DoOperation(GlyphDefinition glyph) 25 | { 26 | foreach (var replacement in _replacements) 27 | { 28 | try 29 | { 30 | var span = _snapshot.CreateTrackingSpan(replacement.OriginalOffset, replacement.OriginalLength, SpanTrackingMode.EdgeNegative).GetSpan(_snapshot); 31 | 32 | if (span.GetText() != replacement.Original) 33 | return; 34 | 35 | var newSpan = span.Snapshot.CreateTrackingSpan(span.Start, replacement.OriginalLength, SpanTrackingMode.EdgeNegative); 36 | 37 | _snapshot.TextBuffer.Replace(newSpan.GetSpan(newSpan.TextBuffer.CurrentSnapshot), replacement.Replacement); 38 | } 39 | catch (Exception e) 40 | { 41 | OutputPane.WriteMessage("error unable to do replacement : {0}", e); 42 | } 43 | } 44 | 45 | glyph.Tag.Tagger.Reset(); 46 | } 47 | } 48 | } -------------------------------------------------------------------------------- /src/Common/src/SSDTDevPack.Common/Clippy/ClippySettings.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using Microsoft.VisualStudio.Shell; 7 | 8 | namespace SSDTDevPack.Clippy 9 | { 10 | public static class ClippySettings 11 | { 12 | public static bool Enabled = false; 13 | 14 | public static OleMenuCommand MenuItem; 15 | 16 | public static Action ClippyDisabled; 17 | 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/Common/src/SSDTDevPack.Common/Clippy/ClippyTaggerProvider.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel.Composition; 3 | using Microsoft.VisualStudio.Text; 4 | using Microsoft.VisualStudio.Text.Classification; 5 | using Microsoft.VisualStudio.Text.Tagging; 6 | using Microsoft.VisualStudio.Utilities; 7 | 8 | namespace SSDTDevPack.Clippy 9 | { 10 | /// 11 | /// Export a 12 | /// 13 | [Export(typeof (ITaggerProvider))] 14 | [ContentType("code")] 15 | [TagType(typeof (ClippyTag))] 16 | internal class ClippyTaggerProvider : ITaggerProvider 17 | { 18 | [Import] internal IClassifierAggregatorService AggregatorFactory; 19 | 20 | /// 21 | /// Creates an instance of our custom ClippyTagger for a given buffer. 22 | /// 23 | /// 24 | /// The buffer we are creating the tagger for. 25 | /// An instance of our custom ClippyTagger. 26 | public ITagger CreateTagger(ITextBuffer buffer) where T : ITag 27 | { 28 | if (buffer == null) 29 | { 30 | throw new ArgumentNullException("buffer"); 31 | } 32 | 33 | return new ClippyTagger(AggregatorFactory.GetClassifier(buffer)) as ITagger; 34 | } 35 | } 36 | } -------------------------------------------------------------------------------- /src/Common/src/SSDTDevPack.Common/Clippy/MainWindow.xaml: -------------------------------------------------------------------------------- 1 |  5 | 6 | 7 | 8 | T-SQL Clippy 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /src/Common/src/SSDTDevPack.Common/Clippy/MainWindow.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Runtime.Remoting.Contexts; 5 | using System.Security.Permissions; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Media; 9 | using System.Windows.Shapes; 10 | using Microsoft.VisualStudio.Text; 11 | 12 | namespace SSDTDevPack.Clippy 13 | { 14 | public enum MenuItemType 15 | { 16 | MenuItem, 17 | Seperator, 18 | Header 19 | } 20 | 21 | public struct MenuDefinition 22 | { 23 | public string Caption; 24 | public MenuItemType Type; 25 | public Action Action; 26 | 27 | public GlyphDefinition Glyph; 28 | public ClippyOperation Operation; 29 | 30 | } 31 | 32 | public partial class MainWindow : Window 33 | { 34 | public MainWindow(List menu) 35 | { 36 | InitializeComponent(); 37 | 38 | foreach (var definition in menu) 39 | { 40 | switch (definition.Type) 41 | { 42 | case MenuItemType.MenuItem: 43 | this.Items.Children.Add(new MenuItem(definition.Caption, definition.Action, this)); 44 | break; 45 | case MenuItemType.Seperator: 46 | 47 | this.Items.Children.Add(new TextBlock(){Height = 10, Padding = new Thickness(5,5,5,5)}); 48 | 49 | break; 50 | case MenuItemType.Header: 51 | this.Items.Children.Add(new TextBlock() { Text = definition.Caption, Foreground = Brushes.Coral}); 52 | break; 53 | default: 54 | throw new ArgumentOutOfRangeException(); 55 | } 56 | 57 | } 58 | 59 | 60 | this.Deactivated += CheckClose; 61 | } 62 | 63 | void CheckClose(object sender, System.EventArgs e) 64 | { 65 | try 66 | { 67 | this.Close(); 68 | } 69 | catch (Exception x) 70 | { 71 | 72 | } 73 | } 74 | 75 | public ContextMenu GetMenu() 76 | { 77 | return ContextMenu; 78 | } 79 | 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /src/Common/src/SSDTDevPack.Common/Clippy/MenuItem.xaml: -------------------------------------------------------------------------------- 1 |  7 | 8 | 9 | 10 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /src/Common/src/SSDTDevPack.Common/Clippy/MenuItem.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Navigation; 14 | using System.Windows.Shapes; 15 | 16 | namespace SSDTDevPack.Clippy 17 | { 18 | /// 19 | /// Interaction logic for MenuItem.xaml 20 | /// 21 | public partial class MenuItem : UserControl 22 | { 23 | private readonly Action _action; 24 | 25 | public MenuItem(string content, Action action, MainWindow mainWindow) 26 | { 27 | _action = action; 28 | InitializeComponent(); 29 | 30 | Title.Text = content; 31 | 32 | MouseLeftButtonUp += (sender, args) => 33 | { 34 | if (_action != null) 35 | { 36 | mainWindow.Close(); 37 | _action(); 38 | } 39 | }; 40 | 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/Common/src/SSDTDevPack.Common/Clippy/Operations/ClippyOperationBuilder.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using Microsoft.SqlServer.TransactSql.ScriptDom; 3 | 4 | namespace SSDTDevPack.Clippy.Operations 5 | { 6 | public abstract class ClippyOperationBuilder 7 | { 8 | public abstract GlyphDefinition GetDefintions(string fragment, TSqlStatement statement, GlyphDefinition definition, List queries); 9 | public abstract GlyphDefinition GetDefintions(string fragment, TSqlStatement statement, GlyphDefinition definition, List queries); 10 | 11 | public abstract GlyphDefinition GetDefinitions(string fragment, TSqlStatement statement, GlyphDefinition definition, List queries); 12 | 13 | protected string GetCaptionForAll(TSqlStatement statement) 14 | { 15 | if (statement is SelectStatement) 16 | return "All on Statement"; 17 | 18 | if (statement.GetType().Name.StartsWith("Create")) 19 | return "All in Module"; 20 | 21 | return "All"; 22 | } 23 | } 24 | } -------------------------------------------------------------------------------- /src/Common/src/SSDTDevPack.Common/Clippy/Operations/QueryCostOperations.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using Microsoft.SqlServer.TransactSql.ScriptDom; 5 | using SSDTDevPack.QueryCosts; 6 | 7 | namespace SSDTDevPack.Clippy.Operations 8 | { 9 | internal class QueryCostOperations : ClippyOperationBuilder 10 | { 11 | public override GlyphDefinition GetDefintions(string fragment, TSqlStatement statement, GlyphDefinition definition, List queries) 12 | { 13 | var documentCoster = DocumentScriptCosters.GetInstance(); 14 | if (documentCoster == null) 15 | return definition; 16 | 17 | var coster = documentCoster.GetCoster(); 18 | if (null == coster) 19 | return definition; 20 | 21 | var statements = coster.GetCosts(); 22 | 23 | if (statements == null || statements.Count == 0) 24 | return definition; 25 | 26 | var thisStatement = fragment; 27 | 28 | var costedStatement = 29 | statements.FirstOrDefault(p => p.Text.IndexOf(thisStatement, StringComparison.OrdinalIgnoreCase) > 0); 30 | 31 | if (costedStatement == null) 32 | return definition; 33 | 34 | definition.Menu.Add(new MenuDefinition 35 | { 36 | Action = null, 37 | Caption = "Query Cost: " + costedStatement.Cost, 38 | Type = MenuItemType.Header 39 | }); 40 | 41 | return definition; 42 | } 43 | 44 | public override GlyphDefinition GetDefintions(string fragment, TSqlStatement statement, GlyphDefinition definition, List queries) 45 | { 46 | return definition; 47 | } 48 | 49 | public override GlyphDefinition GetDefinitions(string fragment, TSqlStatement statement, GlyphDefinition definition, List queries) 50 | { 51 | return definition; 52 | } 53 | } 54 | } -------------------------------------------------------------------------------- /src/Common/src/SSDTDevPack.Common/Clippy/Operations/ReWriterOperation.cs: -------------------------------------------------------------------------------- 1 | namespace SSDTDevPack.Clippy.Operations 2 | { 3 | abstract class ReWriterOperation : ClippyOperationBuilder 4 | { 5 | protected void PerformAction(ClippyOperation operation, GlyphDefinition glyph) 6 | { 7 | if (operation is ClippyReplacementOperations) 8 | { 9 | (operation as ClippyReplacementOperations).DoOperation(glyph); 10 | return; 11 | } 12 | 13 | if (operation is ClippyReplacementOperation) 14 | { 15 | (operation as ClippyReplacementOperation).DoOperation(glyph); 16 | return; 17 | } 18 | } 19 | } 20 | } -------------------------------------------------------------------------------- /src/Common/src/SSDTDevPack.Common/CodeCOverage/CodeCoverageMap.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace SSDTDevPacl.CodeCoverage.Lib 8 | { 9 | public class CodeCoverageMap 10 | { 11 | 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/Common/src/SSDTDevPack.Common/CodeCOverage/CoveredStatement.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace SSDTDevPacl.CodeCoverage.Lib 4 | { 5 | public class CoveredStatement 6 | { 7 | public long Offset; 8 | public long Length; 9 | public int ObjectId; 10 | public string Object; 11 | public string ObjectType; 12 | public DateTimeOffset TimeStamp; 13 | } 14 | } -------------------------------------------------------------------------------- /src/Common/src/SSDTDevPack.Common/CodeCOverage/ExtendedEventDataDataReader.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Concurrent; 3 | using SSDTDevPack.Common.UserMessages; 4 | 5 | namespace SSDTDevPacl.CodeCoverage.Lib 6 | { 7 | public class ExtendedEventDataDataReader 8 | { 9 | private readonly string _connectionString; 10 | 11 | public readonly ConcurrentQueue CoveredStatements = new ConcurrentQueue(); 12 | public readonly ConcurrentDictionary ObjectNameCache = new ConcurrentDictionary(); 13 | 14 | private bool _continue = true; 15 | 16 | private string _databaseName; 17 | 18 | private ExtendedEventGateway _gateway; 19 | 20 | public ExtendedEventDataDataReader(string connectionString) 21 | { 22 | _connectionString = connectionString; 23 | } 24 | 25 | public void Stop() 26 | { 27 | try 28 | { 29 | _gateway.StopTrace(); 30 | 31 | foreach (var item in _gateway.GetStatements(ObjectNameCache)) 32 | { 33 | CoveredStatements.Enqueue(item); 34 | } 35 | } 36 | catch (Exception e) 37 | { 38 | OutputPane.WriteMessageAndActivatePane("CodeCoverage, error stopping the trace: {0}", e); 39 | } 40 | } 41 | 42 | public void Start() 43 | { 44 | try 45 | { 46 | _continue = true; 47 | _gateway = new DatabaseGateway(_connectionString).Get(); 48 | 49 | _gateway.StartTrace(); 50 | } 51 | catch (Exception e) 52 | { 53 | OutputPane.WriteMessageAndActivatePane("CodeCoverage, error starting the trace: {0}", e); 54 | } 55 | } 56 | } 57 | } -------------------------------------------------------------------------------- /src/Common/src/SSDTDevPack.Common/CodeCOverage/Ui/CodeCoverageWindow.xaml: -------------------------------------------------------------------------------- 1 |  9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 30 | 32 | 34 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /src/Common/src/SSDTDevPack.Common/CodeExtractor.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | using EnvDTE; 8 | using Microsoft.SqlServer.TransactSql.ScriptDom; 9 | using SSDTDevPack.Common.Dac; 10 | using SSDTDevPack.Common.ProjectItems; 11 | using SSDTDevPack.Common.ScriptDom; 12 | using SSDTDevPack.Common.SolutionBrowser; 13 | 14 | namespace SSDTDevPack.Extraction 15 | { 16 | public class CodeExtractor 17 | { 18 | private readonly string _code; 19 | 20 | public CodeExtractor(string code) 21 | { 22 | _code = code; 23 | } 24 | 25 | public string ExtractIntoFunction() 26 | { 27 | var browser = new SolutionBrowserForm(""); 28 | browser.ShowDialog(); 29 | 30 | var destination = browser.DestinationItem; 31 | if (destination == null) 32 | return null; 33 | 34 | var name = browser.GetObjectName(); 35 | 36 | var function = new CreateFunctionStatement(); 37 | var returnSelect = (function.ReturnType = new SelectFunctionReturnType()) as SelectFunctionReturnType; 38 | returnSelect.SelectStatement = GetSelectStatementForQuery(); 39 | function.Name = name.ToSchemaObjectName(); 40 | 41 | var classFolder = destination.ProjectItems.AddFromTemplate("Procedure", name.UnQuote() + ".sql"); 42 | var filePath = classFolder.GetStringProperty("FullPath"); 43 | 44 | File.WriteAllText(filePath, ScriptDom.GenerateTSql(function)); 45 | 46 | classFolder.Open().Visible = true; 47 | 48 | return GetCallingCode(function); 49 | 50 | } 51 | 52 | private string GetCallingCode(CreateFunctionStatement function) 53 | { 54 | var callingSelect = new SelectStatement(); 55 | var spec = (callingSelect.QueryExpression = new QuerySpecification()) as QuerySpecification; 56 | spec.FromClause = new FromClause(); 57 | spec.FromClause.TableReferences.Add(new SchemaObjectFunctionTableReference() 58 | { 59 | SchemaObject = function.Name 60 | }); 61 | 62 | spec.SelectElements.Add(new SelectStarExpression()); 63 | 64 | return ScriptDom.GenerateTSql(spec); 65 | } 66 | 67 | private SelectStatement GetSelectStatementForQuery() 68 | { 69 | return ScriptDom.GetSelects(_code).FirstOrDefault(); 70 | } 71 | 72 | 73 | } 74 | 75 | 76 | 77 | 78 | } 79 | -------------------------------------------------------------------------------- /src/Common/src/SSDTDevPack.Common/ConnectionDialog/LabelledTextbox.xaml: -------------------------------------------------------------------------------- 1 |  8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /src/Common/src/SSDTDevPack.Common/ConnectionDialog/LabelledTextbox.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Navigation; 14 | using System.Windows.Shapes; 15 | 16 | namespace SSDTDevPack.Common.ConnectionDialog 17 | { 18 | /// 19 | /// Interaction logic for LabelledTextbox.xaml 20 | /// 21 | public partial class LabelledTextbox : UserControl 22 | { 23 | public LabelledTextbox(string label, string text) 24 | { 25 | InitializeComponent(); 26 | 27 | Label.Content = label; 28 | TextBlock.Text = text; 29 | } 30 | 31 | public string Text() 32 | { 33 | return TextBlock.Text; 34 | } 35 | 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/Common/src/SSDTDevPack.Common/ConnectionDialog/SqlConnectionDialog.xaml: -------------------------------------------------------------------------------- 1 |  11 | 12 | 13 | 14 | 15 | Server Name 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | User Name (leave blank for windows authentication) 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /src/Common/src/SSDTDevPack.Common/Dac/ColumnDescriptor.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq; 3 | using System.Text; 4 | using System.Threading.Tasks; 5 | using Microsoft.SqlServer.Dac.Extensions.Prototype; 6 | using Microsoft.SqlServer.Dac.Model; 7 | using Microsoft.SqlServer.TransactSql.ScriptDom; 8 | 9 | namespace SSDTDevPack.Common.Dac 10 | { 11 | public class ColumnDescriptor 12 | { 13 | public ColumnDescriptor(TSqlColumn column) 14 | { 15 | Name = column.Name; 16 | UnderlyingType = column.DataType.FirstOrDefault().Name.GetName(); 17 | DataType = LiteralConverter.GetLiteralType(column.DataType.FirstOrDefault().Name); 18 | IsNText = LiteralConverter.IsNText(column.DataType.FirstOrDefault().Name); 19 | 20 | DataLength = column.Length; 21 | 22 | IsIdentity = column.IsIdentity; 23 | IsKey = column.GetReferencingRelationshipInstances(PrimaryKeyConstraint.Columns).FirstOrDefault() != null; 24 | 25 | } 26 | 27 | public string UnderlyingType { get; set; } 28 | public ObjectIdentifier Name { get; set; } 29 | public LiteralType DataType { get; set; } 30 | public int DataTypeLength { get; set; } 31 | 32 | public int DataLength { get; set; } 33 | public bool IsKey { get; set; } 34 | public bool IsIdentity { get; set; } 35 | 36 | public bool IsNText { get; set; } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/Common/src/SSDTDevPack.Common/Dac/DacpacPath.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using EnvDTE; 5 | 6 | namespace SSDTDevPack.Common.Dac 7 | { 8 | public class DacpacPath 9 | { 10 | private const string DacpacExtension = ".dacpac"; 11 | 12 | public static string Get(Project project) 13 | { 14 | 15 | var config = project.ConfigurationManager.ActiveConfiguration; 16 | 17 | 18 | var builtGroup = 19 | project.ConfigurationManager.ActiveConfiguration.OutputGroups.OfType() 20 | .First(x => x.CanonicalName == "Built"); 21 | 22 | try 23 | { 24 | if (builtGroup.FileURLs == null) 25 | return null; 26 | } 27 | catch (Exception e) 28 | { 29 | return null; 30 | } 31 | 32 | foreach (var strUri in ((object[]) builtGroup.FileURLs).OfType()) 33 | { 34 | var uri = new Uri(strUri, UriKind.Absolute); 35 | var filePath = uri.LocalPath; 36 | 37 | if (filePath.EndsWith(DacpacExtension, StringComparison.OrdinalIgnoreCase)) 38 | return filePath; 39 | } 40 | 41 | return null; 42 | } 43 | } 44 | } -------------------------------------------------------------------------------- /src/Common/src/SSDTDevPack.Common/Dac/Model.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using Microsoft.SqlServer.Dac.Extensions.Prototype; 3 | 4 | namespace SSDTDevPack.Common.Dac 5 | { 6 | public class Model 7 | { 8 | static readonly Dictionary Models = new Dictionary(); 9 | 10 | /// 11 | /// DO NOT use using on mode, instead call Model.Close! really important!!!!!! 12 | /// 13 | /// 14 | /// 15 | public static TSqlTypedModel Get(string path) 16 | { 17 | lock (Models) 18 | { 19 | if (Models.ContainsKey(path)) 20 | { 21 | var reference = Models[path]; 22 | reference.ReferenceCount++; 23 | return reference.Model; 24 | } 25 | 26 | var newReference = new ModelReference(); 27 | newReference.Model = new TSqlTypedModel(path); 28 | newReference.ReferenceCount = 1; 29 | Models.Add(path, newReference); 30 | return newReference.Model; 31 | } 32 | } 33 | 34 | public static void Close(string path) 35 | { 36 | lock (Models) 37 | { 38 | if (!Models.ContainsKey(path)) 39 | return; 40 | 41 | var reference = Models[path]; 42 | reference.ReferenceCount--; 43 | 44 | if (reference.ReferenceCount <= 0) 45 | { 46 | reference.Model.Dispose(); 47 | Models.Remove(path); 48 | } 49 | } 50 | } 51 | } 52 | 53 | class ModelReference 54 | { 55 | public int ReferenceCount; 56 | public TSqlTypedModel Model; 57 | } 58 | } -------------------------------------------------------------------------------- /src/Common/src/SSDTDevPack.Common/Dac/ProcedureRepository.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections; 3 | using System.Collections.Generic; 4 | using Microsoft.SqlServer.Dac.Extensions.Prototype; 5 | using Microsoft.SqlServer.Dac.Model; 6 | 7 | namespace SSDTDevPack.Common.Dac 8 | { 9 | public class ProcedureRepository : IDisposable, IEnumerable 10 | { 11 | private readonly string _path; 12 | 13 | public ProcedureRepository(string path) 14 | { 15 | _path = path; 16 | _model = Model.Get(path); 17 | 18 | _procedures = _model.GetObjects(DacQueryScopes.UserDefined); 19 | 20 | } 21 | 22 | public void Dispose() 23 | { 24 | Model.Close(_path); 25 | } 26 | 27 | private readonly IEnumerable _procedures; 28 | private readonly TSqlTypedModel _model; 29 | 30 | public IEnumerator GetEnumerator() 31 | { 32 | return _procedures.GetEnumerator(); 33 | } 34 | 35 | IEnumerator IEnumerable.GetEnumerator() 36 | { 37 | return GetEnumerator(); 38 | } 39 | } 40 | 41 | public class FunctionRepository : IDisposable, IEnumerable 42 | { 43 | private readonly string _path; 44 | 45 | public FunctionRepository(string path) 46 | { 47 | _path = path; 48 | _model = Model.Get(path); 49 | 50 | _procedures = _model.GetObjects(DacQueryScopes.UserDefined); 51 | 52 | } 53 | 54 | public void Dispose() 55 | { 56 | Model.Close(_path); 57 | } 58 | 59 | private readonly IEnumerable _procedures; 60 | private readonly TSqlTypedModel _model; 61 | 62 | public IEnumerator GetEnumerator() 63 | { 64 | return _procedures.GetEnumerator(); 65 | } 66 | 67 | IEnumerator IEnumerable.GetEnumerator() 68 | { 69 | return GetEnumerator(); 70 | } 71 | } 72 | } -------------------------------------------------------------------------------- /src/Common/src/SSDTDevPack.Common/Dac/TableRepository.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Linq; 3 | using Microsoft.SqlServer.Dac.Extensions.Prototype; 4 | using Microsoft.SqlServer.Dac.Model; 5 | 6 | namespace SSDTDevPack.Common.Dac 7 | { 8 | public class TableRepository 9 | { 10 | private readonly string _path; 11 | private List _tables; 12 | 13 | public TableRepository(string path) 14 | { 15 | _path = path; 16 | } 17 | 18 | 19 | public List Get() 20 | { 21 | if (_tables == null) 22 | BuildTables(); 23 | 24 | return _tables; 25 | } 26 | 27 | private void BuildTables() 28 | { 29 | var model = Model.Get(_path); 30 | var dacTables = model.GetObjects(DacQueryScopes.UserDefined); 31 | 32 | _tables = dacTables.Select(t => new TableDescriptor(t)).ToList(); 33 | 34 | Model.Close(_path); 35 | 36 | } 37 | } 38 | } -------------------------------------------------------------------------------- /src/Common/src/SSDTDevPack.Common/Enumerators/ProjectEnumerator.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using EnvDTE; 4 | using Microsoft.VisualStudio.Shell.Interop; 5 | using SSDTDevPack.Common.VSPackage; 6 | using SSDTDevPack.Logging; 7 | using System.Linq; 8 | using System.Reflection; 9 | using static System.Reflection.BindingFlags; 10 | 11 | namespace SSDTDevPack.Common.Enumerators 12 | { 13 | public class ProjectEnumerator 14 | { 15 | public IList Get(string projectType) 16 | { 17 | var dte = VsServiceProvider.Get(typeof (SDTE)) as DTE; 18 | 19 | var projects = new List(); 20 | for (var i = 1; i <= dte.Solution.Projects.Count; i++) 21 | { 22 | var project = dte.Solution.Projects.Item(i); 23 | 24 | Log.WriteInfo("ProjectEnumerator: Have Project: {0}", project.FullName); 25 | projects.AddRange(GetChildren(projectType, project)); 26 | } 27 | return projects; 28 | } 29 | 30 | private IList GetChildren(string projectType, Project project) 31 | { 32 | var projects = new List(); 33 | 34 | for (var i = 1; i <= project.ProjectItems.Count; i++) 35 | { 36 | var item = project.ProjectItems.Item(i); 37 | if (item.SubProject != null) 38 | { 39 | projects.AddRange(GetChildren(projectType, item.SubProject)); 40 | } 41 | 42 | if (/*new Guid(item.Kind).Equals(new Guid(projectType))*/ 43 | item.Kind == projectType) 44 | { 45 | Log.WriteInfo("ProjectEnumerator: Adding Project: {0}", project.FullName); 46 | projects.Add(item.SubProject); 47 | } 48 | else 49 | { 50 | Log.WriteInfo( 51 | "ProjectEnumerator: Not Adding Project: {0} because it is the incorrect kind (kind={1} + wanted={2})", 52 | project.FullName, project.Kind, projectType); 53 | } 54 | } 55 | 56 | if (new Guid(project.Kind).Equals(new Guid(projectType))) 57 | { 58 | Log.WriteInfo("ProjectEnumerator: Adding Project: {0}", project.FullName); 59 | projects.Add(project); 60 | } 61 | 62 | return projects; 63 | } 64 | } 65 | } -------------------------------------------------------------------------------- /src/Common/src/SSDTDevPack.Common/Enumerators/ProjectItemEnumerator.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using EnvDTE; 3 | 4 | namespace SSDTDevPack.Common.Enumerators 5 | { 6 | public class ProjectItemEnumerator 7 | { 8 | public IList Get(Project project) 9 | { 10 | var items = new List(); 11 | 12 | for (var i = 1; i <= project.ProjectItems.Count; i++) 13 | { 14 | if (project.ProjectItems.Item(i).ProjectItems != null) 15 | { 16 | items.AddRange(GetChildItems(project.ProjectItems.Item(i))); 17 | } 18 | } 19 | 20 | return items; 21 | } 22 | 23 | private IList GetChildItems(ProjectItem item) 24 | { 25 | var items = new List(); 26 | 27 | items.Add(item); 28 | 29 | if (item.ProjectItems == null || item.ProjectItems.Count == 0) 30 | { 31 | return items; 32 | } 33 | 34 | for (var i = 1; i <= item.ProjectItems.Count; i++) 35 | { 36 | var childItem = item.ProjectItems.Item(i); 37 | items.AddRange(GetChildItems(childItem)); 38 | } 39 | 40 | return items; 41 | } 42 | } 43 | } -------------------------------------------------------------------------------- /src/Common/src/SSDTDevPack.Common/Enumerators/ProjectType.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace SSDTDevPack.Common.Enumerators 8 | { 9 | public static class ProjectType 10 | { 11 | public static string SSDT = "{00d1a9c2-b5f0-4af3-8072-f6c62b433612}"; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/Common/src/SSDTDevPack.Common/Enumerators/tSQLt/TestClassEnumerator.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using EnvDTE; 7 | using Microsoft.SqlServer.Dac.Extensions.Prototype; 8 | using Microsoft.SqlServer.Dac.Model; 9 | using Microsoft.SqlServer.TransactSql.ScriptDom; 10 | using SSDTDevPack.Common.Dac; 11 | 12 | namespace SSDTDevPack.Common.Enumerators.tSQLt 13 | { 14 | public class TestClassEnumerator 15 | { 16 | public TestClassEnumerator(string path) 17 | { 18 | var tSQLtName = new SchemaObjectName(); 19 | tSQLtName.Identifiers.Add(new Identifier() {Value = "tSQLt"}); 20 | tSQLtName.Identifiers.Add(new Identifier() { Value = "TestClass" }); 21 | 22 | 23 | var model = Model.Get(path); 24 | var extendedProperties = model.GetObjects(DacQueryScopes.UserDefined).Where(s => s.Name.EqualsName(tSQLtName)); 25 | 26 | foreach (var prop in extendedProperties) 27 | { 28 | Console.WriteLine(prop.Name); 29 | } 30 | 31 | //_tables = dacTables.Select(t => new TableDescriptor(t)).ToList(); 32 | 33 | 34 | 35 | Model.Close(path); 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/Common/src/SSDTDevPack.Common/Key.snk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GoEddie/SSDT-DevPack/0915f2acf4add5482221ec6c8dd55c8ca34d0c52/src/Common/src/SSDTDevPack.Common/Key.snk -------------------------------------------------------------------------------- /src/Common/src/SSDTDevPack.Common/KeywordCaser.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using Microsoft.SqlServer.TransactSql.ScriptDom; 7 | using SSDTDevPack.Common.ScriptDom; 8 | 9 | namespace SSDTDevPack.Formatting 10 | { 11 | public class KeywordCaser 12 | { 13 | 14 | 15 | public static string KeywordsToUpper(string script) 16 | { 17 | var fragment = ScriptDom.GetFragment(script); 18 | 19 | var builder = new StringBuilder(); 20 | 21 | foreach (var t in fragment.ScriptTokenStream) 22 | { 23 | 24 | if (string.IsNullOrEmpty(t.Text)) 25 | continue; 26 | 27 | if (IsKeyword(t)) 28 | builder.Append(t.Text.ToUpper()); 29 | else 30 | builder.Append(t.Text); 31 | 32 | } 33 | 34 | return builder.ToString(); 35 | } 36 | 37 | public static string KeywordsToLower(string script) 38 | { 39 | var fragment = ScriptDom.GetFragment(script); 40 | 41 | var builder = new StringBuilder(); 42 | 43 | foreach (var t in fragment.ScriptTokenStream) 44 | { 45 | if (string.IsNullOrEmpty(t.Text)) 46 | continue; 47 | 48 | if (IsKeyword(t)) 49 | builder.Append(t.Text.ToLower()); 50 | else 51 | builder.Append(t.Text); 52 | 53 | } 54 | 55 | return builder.ToString(); 56 | } 57 | 58 | private static readonly List _additionalKeywords = new List(){"RETURNS"}; 59 | 60 | private static bool IsKeyword(TSqlParserToken sqlParserToken) 61 | { 62 | return sqlParserToken.IsKeyword() || _additionalKeywords.Any(p => p == sqlParserToken.Text.ToUpper()); 63 | } 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /src/Common/src/SSDTDevPack.Common/Log.cs: -------------------------------------------------------------------------------- 1 | using NLog; 2 | 3 | namespace SSDTDevPack.Logging 4 | { 5 | public class Log 6 | { 7 | private static readonly Logger logger = LogManager.GetCurrentClassLogger(); 8 | 9 | public static void WriteInfo(string message) 10 | { 11 | logger.Info(message); 12 | } 13 | 14 | public static void WriteInfo(string format, params object[] parameters) 15 | { 16 | logger.Info(format, parameters); 17 | } 18 | } 19 | } -------------------------------------------------------------------------------- /src/Common/src/SSDTDevPack.Common/Merge/069085-black-paint-splatter-icon-alphanumeric-letter-m.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GoEddie/SSDT-DevPack/0915f2acf4add5482221ec6c8dd55c8ca34d0c52/src/Common/src/SSDTDevPack.Common/Merge/069085-black-paint-splatter-icon-alphanumeric-letter-m.png -------------------------------------------------------------------------------- /src/Common/src/SSDTDevPack.Common/Merge/MergeDescriptor/MergeOptions.cs: -------------------------------------------------------------------------------- 1 | namespace SSDTDevPack.Merge.MergeDescriptor 2 | { 3 | public class MergeOptions 4 | { 5 | 6 | 7 | public MergeOptions(bool hasUpdate, bool hasInsert, bool hasDelete, bool hasSearchKeys) 8 | { 9 | HasUpdate = hasUpdate; 10 | HasInsert = hasInsert; 11 | HasDelete = hasDelete; 12 | 13 | HasSearchKeys = hasSearchKeys; 14 | } 15 | 16 | public bool HasUpdate { get; set; } 17 | public bool HasInsert { get; set; } 18 | public bool HasDelete { get; set; } 19 | 20 | public bool HasSearchKeys { get; set; } 21 | } 22 | } -------------------------------------------------------------------------------- /src/Common/src/SSDTDevPack.Common/Merge/Parsing/MergeStatementFactory.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Data; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | using Microsoft.SqlServer.TransactSql.ScriptDom; 8 | using SSDTDevPack.Common.Dac; 9 | using SSDTDevPack.Merge.MergeDescriptor; 10 | 11 | namespace SSDTDevPack.Merge.Parsing 12 | { 13 | public class MergeStatementFactory 14 | { 15 | public MergeDescriptor.Merge Build(TableDescriptor table, string scriptFile, DataTable data = null) 16 | { 17 | 18 | var merge = new MergeDescriptor.Merge(); 19 | merge.Name = table.Name.ToIdentifier(); 20 | 21 | if(data == null) 22 | merge.Data = BuildDataTableDefinition( table); 23 | else 24 | { 25 | merge.Data = data; 26 | } 27 | merge.ScriptDescriptor = new InScriptDescriptor(0,0, scriptFile); 28 | merge.Statement = new MergeStatement(); 29 | merge.Table = table; 30 | 31 | 32 | 33 | merge.Data.AcceptChanges(); 34 | 35 | merge.Option = new MergeOptions(true, true, true, merge.Table.Columns.Any(p=>p.IsKey)); 36 | return merge; 37 | } 38 | 39 | private DataTable BuildDataTableDefinition(TableDescriptor table) 40 | { 41 | var dataTable = new DataTable(); 42 | foreach (var col in table.Columns) 43 | { 44 | dataTable.Columns.Add(new DataColumn(col.Name.GetName())); 45 | } 46 | 47 | dataTable.AcceptChanges(); 48 | 49 | dataTable.RowChanged += (sender, args) => 50 | { 51 | dataTable.ExtendedProperties["Changed"] = true; 52 | }; 53 | 54 | dataTable.TableNewRow += (sender, args) => 55 | { 56 | dataTable.ExtendedProperties["Changed"] = true; 57 | }; 58 | 59 | dataTable.RowDeleting += (sender, args) => 60 | { 61 | dataTable.ExtendedProperties["Changed"] = true; 62 | }; 63 | 64 | return dataTable; 65 | } 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /src/Common/src/SSDTDevPack.Common/Merge/Parsing/MergeStatementParser.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using Microsoft.SqlServer.TransactSql.ScriptDom; 7 | 8 | namespace SSDTDevPack.Merge.Parsing 9 | { 10 | public class MergeStatementParser : TSqlFragmentVisitor 11 | { 12 | public MergeStatementParser() 13 | { 14 | Merges = new List(); 15 | } 16 | 17 | public List Merges { private set; get; } 18 | 19 | public override void ExplicitVisit(MergeStatement node) 20 | { 21 | Merges.Add(node); 22 | base.ExplicitVisit(node); 23 | } 24 | 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/Common/src/SSDTDevPack.Common/Merge/UI/AddTableDialog.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Data; 5 | using System.Drawing; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Threading.Tasks; 9 | using System.Windows.Controls; 10 | using System.Windows.Forms; 11 | 12 | namespace SSDTDevPack.Merge.UI 13 | { 14 | public partial class AddTableDialog : Form 15 | { 16 | private readonly List _tableList; 17 | 18 | public AddTableDialog(List tableList) 19 | { 20 | _tableList = tableList; 21 | InitializeComponent(); 22 | 23 | 24 | } 25 | 26 | private void AddFileDialog_Load(object sender, EventArgs e) 27 | { 28 | foreach (var table in _tableList) 29 | { 30 | tableListDropDown.Items.Add(table); 31 | } 32 | } 33 | 34 | public string GetSelectedTable() 35 | { 36 | if (!_allow) 37 | return null; 38 | 39 | if (tableListDropDown.SelectedIndex < 0) 40 | return null; 41 | 42 | return tableListDropDown.Items[tableListDropDown.SelectedIndex] as string; 43 | } 44 | 45 | private void tableListDropDown_SelectedIndexChanged(object sender, EventArgs e) 46 | { 47 | 48 | } 49 | 50 | bool _allow = false; 51 | 52 | private void button1_Click(object sender, EventArgs e) 53 | { 54 | _allow = true; 55 | this.Close(); 56 | } 57 | 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /src/Common/src/SSDTDevPack.Common/Merge/UI/ConnectDialog.cs: -------------------------------------------------------------------------------- 1 | using System.Windows.Forms; 2 | 3 | namespace SSDTDevPack.Merge.UI 4 | { 5 | public partial class ConnectDialog : Form 6 | { 7 | public string ConnectionString; 8 | 9 | public ConnectDialog() 10 | { 11 | InitializeComponent(); 12 | 13 | dialog.SetNotification(ConnectionAvailable); 14 | 15 | } 16 | 17 | public void ConnectionAvailable(string connection) 18 | { 19 | ConnectionString = connection; 20 | Close(); 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /src/Common/src/SSDTDevPack.Common/Merge/UI/TablePage.xaml: -------------------------------------------------------------------------------- 1 |  11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 29 | 30 | -------------------------------------------------------------------------------- /src/Common/src/SSDTDevPack.Common/Merge/UI/UIProperties.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Data; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | using System.Windows; 8 | 9 | namespace SSDTDevPack.Merge.UI 10 | { 11 | /// 12 | /// If you hide it in plain site, no one will see it - certainly no one would expect you to call a god class God 13 | /// 14 | public static class God 15 | { 16 | public static DataTable CurrentMergeData { get; set; } 17 | 18 | public static MergeDescriptor.Merge Merge { get; set; } 19 | 20 | public static Action DataTableChanged { get; set; } 21 | 22 | public static List MergesToSave { get; set; } 23 | 24 | static God() 25 | { 26 | MergesToSave = new List(); 27 | } 28 | } 29 | 30 | 31 | } 32 | -------------------------------------------------------------------------------- /src/Common/src/SSDTDevPack.Common/Merge/UI/UiSettings.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace SSDTDevPack.Merge.UI 8 | { 9 | static class UiSettings 10 | { 11 | public static string ConnectionString; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/Common/src/SSDTDevPack.Common/ProjectItems/Extensions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using EnvDTE; 7 | 8 | namespace SSDTDevPack.Common.ProjectItems 9 | { 10 | public static class Extensions 11 | { 12 | public static bool HasBuildAction(this EnvDTE.ProjectItem item, string buildAction) 13 | { 14 | return item.Properties != null && item.Properties.Cast().Any(property => property.Name == "BuildAction" && property.Value.ToString() == buildAction); 15 | } 16 | 17 | public static string GetStringProperty(this EnvDTE.ProjectItem item, string propertyName) 18 | { 19 | if (item.Properties == null) 20 | return null; 21 | 22 | var prop = item.Properties.Cast().FirstOrDefault(property => property.Name == propertyName); 23 | if (prop != null) 24 | return prop.Value; 25 | 26 | return null; 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/Common/src/SSDTDevPack.Common/ProjectItems/ScriptDom/Quote.cs: -------------------------------------------------------------------------------- 1 | namespace SSDTDevPack.Merge.MergeDescriptor 2 | { 3 | public static class Quote 4 | { 5 | public static string Name(string source) 6 | { 7 | if (source.Length < 1) 8 | return source; 9 | 10 | if (source[0] == '[') 11 | return source; 12 | 13 | return string.Format("[{0}]", source); 14 | } 15 | } 16 | } -------------------------------------------------------------------------------- /src/Common/src/SSDTDevPack.Common/ProjectItems/ScriptDom/ScriptParser.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.IO; 3 | using System.Text; 4 | using Microsoft.SqlServer.TransactSql.ScriptDom; 5 | using SSDTDevPack.Common.ProjectVersion; 6 | using SSDTDevPack.Logging; 7 | 8 | namespace SSDTDevPack.Common.ScriptDom 9 | { 10 | public class ScriptParser 11 | { 12 | private readonly string _path; 13 | private readonly TSqlFragmentVisitor _visitor; 14 | 15 | public ScriptParser(TSqlFragmentVisitor visitor, string path) 16 | { 17 | _visitor = visitor; 18 | _path = path; 19 | } 20 | 21 | public void Parse() 22 | { 23 | using (var reader = GetScriptReader()) 24 | { 25 | var parser = VersionDetector.ParserFactory(false); 26 | 27 | IList errors; 28 | var sqlFragment = parser.Parse(reader, out errors); 29 | 30 | if (errors.Count > 0) 31 | { 32 | foreach (var error in errors) 33 | { 34 | Log.WriteInfo(_path, error.Line, "Script Parser: Error in {0} error: {1}", _path, error.Message); 35 | } 36 | } 37 | 38 | sqlFragment.Accept(_visitor); 39 | } 40 | } 41 | 42 | private TextReader GetScriptReader() 43 | { 44 | var scriptBuffer = new StringBuilder(); 45 | 46 | using (var reader = new StreamReader(_path)) 47 | { 48 | while (!reader.EndOfStream) 49 | { 50 | var line = reader.ReadLine(); 51 | if (line.StartsWith(":")) 52 | { 53 | scriptBuffer.Append("--"); 54 | 55 | if (line.Length < 2) 56 | { 57 | Log.WriteInfo("ScriptParser - found : import but line length < 2 - this is a problem"); 58 | return new StringReader(scriptBuffer.ToString()); 59 | } 60 | 61 | scriptBuffer.AppendLine(line.Substring(2)); 62 | } 63 | else 64 | { 65 | scriptBuffer.AppendLine(line); 66 | } 67 | 68 | } 69 | } 70 | 71 | return new StringReader(scriptBuffer.ToString()); 72 | } 73 | } 74 | } -------------------------------------------------------------------------------- /src/Common/src/SSDTDevPack.Common/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("SSDTDevPack.Common")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("SSDTDevPack.Common")] 13 | [assembly: AssemblyCopyright("NO Copyright Ed Elliott 2015")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("d65837e8-b729-4a69-9283-2460dd288fee")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.9.23.1")] 36 | [assembly: AssemblyFileVersion("1.9.23.1")] 37 | -------------------------------------------------------------------------------- /src/Common/src/SSDTDevPack.Common/QueryCosts/DocumentScriptCosters.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using EnvDTE; 3 | 4 | namespace SSDTDevPack.QueryCosts 5 | { 6 | /* 7 | There are two users of this, firstly when the "Toggle Query Costs" command is run in visual studio, it is within the vspackage so has full access to the DTE 8 | * so it passes it here so that we can always work with the active document - the second client is the actual highlighter and that has no dte so it uses whatever one is here 9 | */ 10 | public class DocumentScriptCosters 11 | { 12 | private readonly Dictionary _costers = new Dictionary(); 13 | 14 | static readonly DocumentScriptCosters Instance = new DocumentScriptCosters(); 15 | 16 | public static DocumentScriptCosters GetInstance() 17 | { 18 | return Instance; 19 | } 20 | 21 | private static DTE _dte; 22 | 23 | public static void SetDte(DTE dte) 24 | { 25 | _dte = dte; 26 | } 27 | 28 | public void ClearCache() 29 | { 30 | 31 | lock (_costers) 32 | { 33 | foreach (var coster in _costers.Values) 34 | { 35 | coster.ShowCosts = false; 36 | } 37 | _costers.Clear(); 38 | } 39 | } 40 | 41 | public ScriptCoster GetCoster() 42 | { 43 | lock (_costers){ 44 | if (_dte == null || _dte.ActiveDocument == null || _dte.ActiveDocument.FullName == null) 45 | { 46 | return null; 47 | } 48 | 49 | if (_costers.ContainsKey(_dte.ActiveDocument.FullName)) 50 | return _costers[_dte.ActiveDocument.FullName]; 51 | 52 | var coster = new ScriptCoster(_dte); 53 | _costers[_dte.ActiveDocument.FullName] = coster; 54 | return coster; 55 | } 56 | } 57 | } 58 | } -------------------------------------------------------------------------------- /src/Common/src/SSDTDevPack.Common/QueryCosts/Highlighter/HighlightWordFormatDefinition.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel.Composition; 2 | using System.Windows.Media; 3 | using Microsoft.VisualStudio.Text.Classification; 4 | using Microsoft.VisualStudio.Utilities; 5 | 6 | namespace SSDTDevPack.QueryCosts.Highlighter 7 | { 8 | [Export(typeof(EditorFormatDefinition))] 9 | [Name("QueryCostFormatDefinition/HighlightWordFormatDefinition")] 10 | [UserVisible(true)] 11 | class HighlightWordFormatDefinition : MarkerFormatDefinition 12 | { 13 | 14 | public HighlightWordFormatDefinition() 15 | { 16 | var brush = new SolidColorBrush(); 17 | brush.Color = Colors.Red; 18 | brush.Opacity = 0.45; 19 | 20 | this.Fill = brush; 21 | 22 | this.ForegroundColor = Colors.DarkBlue; 23 | this.DisplayName = "Highlight Word"; 24 | this.ZOrder = 5; 25 | } 26 | } 27 | } -------------------------------------------------------------------------------- /src/Common/src/SSDTDevPack.Common/QueryCosts/Highlighter/HighlightWordTag.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.VisualStudio.Text.Tagging; 2 | 3 | namespace SSDTDevPack.QueryCosts.Highlighter 4 | { 5 | public class HighlightWordTag : TextMarkerTag 6 | { 7 | public HighlightWordTag() : base("QueryCostFormatDefinition/HighlightWordFormatDefinition") { } 8 | } 9 | } -------------------------------------------------------------------------------- /src/Common/src/SSDTDevPack.Common/QueryCosts/Highlighter/HighlightWordTaggerProvider.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel.Composition; 2 | using Microsoft.VisualStudio.Text; 3 | using Microsoft.VisualStudio.Text.Editor; 4 | using Microsoft.VisualStudio.Text.Operations; 5 | using Microsoft.VisualStudio.Text.Tagging; 6 | using Microsoft.VisualStudio.Utilities; 7 | 8 | namespace SSDTDevPack.QueryCosts.Highlighter 9 | { 10 | 11 | [Export(typeof(IViewTaggerProvider))] 12 | [ContentType("text")] 13 | [TagType(typeof(TextMarkerTag))] 14 | internal class HighlightWordTaggerProvider : IViewTaggerProvider 15 | { 16 | [Import] 17 | internal ITextSearchService TextSearchService { get; set; } 18 | 19 | [Import] 20 | internal ITextStructureNavigatorSelectorService TextStructureNavigatorSelector { get; set; } 21 | 22 | public ITagger CreateTagger(ITextView textView, ITextBuffer buffer) where T : ITag 23 | { 24 | //provide highlighting only on the top buffer 25 | if (textView.TextBuffer != buffer) 26 | return null; 27 | 28 | ITextStructureNavigator textStructureNavigator = 29 | TextStructureNavigatorSelector.GetTextStructureNavigator(buffer); 30 | 31 | return new QueryCostHighlightWordTagger(textView, buffer, TextSearchService, textStructureNavigator) as ITagger; 32 | } 33 | } 34 | 35 | [Export(typeof(IViewTaggerProvider))] 36 | [ContentType("text")] 37 | [TagType(typeof(TextMarkerTag))] 38 | internal class CodeCoverageTaggerProvider : IViewTaggerProvider 39 | { 40 | [Import] 41 | internal ITextSearchService TextSearchService { get; set; } 42 | 43 | [Import] 44 | internal ITextStructureNavigatorSelectorService TextStructureNavigatorSelector { get; set; } 45 | 46 | public ITagger CreateTagger(ITextView textView, ITextBuffer buffer) where T : ITag 47 | { 48 | //provide highlighting only on the top buffer 49 | if (textView.TextBuffer != buffer) 50 | return null; 51 | 52 | ITextStructureNavigator textStructureNavigator = 53 | TextStructureNavigatorSelector.GetTextStructureNavigator(buffer); 54 | 55 | return new CodeCoverageHighlightWordTagger(textView, buffer, TextSearchService, textStructureNavigator) as ITagger; 56 | } 57 | } 58 | } -------------------------------------------------------------------------------- /src/Common/src/SSDTDevPack.Common/QueryCosts/Highlighter/LowlightWordFormatDefinition.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel.Composition; 2 | using System.Windows.Media; 3 | using Microsoft.VisualStudio.Text.Classification; 4 | using Microsoft.VisualStudio.Utilities; 5 | 6 | namespace SSDTDevPack.QueryCosts.Highlighter 7 | { 8 | [Export(typeof(EditorFormatDefinition))] 9 | [Name("QueryCostFormatDefinition/LowlightWordFormatDefinition")] 10 | [UserVisible(true)] 11 | class LowlightWordFormatDefinition : MarkerFormatDefinition 12 | { 13 | 14 | public LowlightWordFormatDefinition() 15 | { 16 | 17 | var brush = new SolidColorBrush(); 18 | brush.Color = Colors.Orange; 19 | brush.Opacity = 0.45; 20 | 21 | this.Fill = brush; 22 | 23 | this.ForegroundColor = Colors.DarkBlue; 24 | this.DisplayName = "Highlight Word"; 25 | this.ZOrder = 5; 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/Common/src/SSDTDevPack.Common/QueryCosts/Highlighter/LowlightWordTag.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.VisualStudio.Text.Tagging; 2 | 3 | namespace SSDTDevPack.QueryCosts.Highlighter 4 | { 5 | public class LowlightWordTag : TextMarkerTag 6 | { 7 | public LowlightWordTag() : base("QueryCostFormatDefinition/LowlightWordFormatDefinition") { } 8 | } 9 | } -------------------------------------------------------------------------------- /src/Common/src/SSDTDevPack.Common/QueryCosts/ScriptCoster.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Linq; 5 | using System.Security.Cryptography.X509Certificates; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | using EnvDTE; 9 | using SSDTDevPack.Merge.UI; 10 | 11 | namespace SSDTDevPack.QueryCosts 12 | { 13 | public class ScriptCoster 14 | { 15 | private static string ConnectionString; 16 | private QueryCostStore Store; 17 | private DTE Dte; 18 | 19 | 20 | public ScriptCoster(DTE dte) 21 | { 22 | 23 | Dte = dte; 24 | } 25 | 26 | void BuildStore() 27 | { 28 | if (String.IsNullOrEmpty(ConnectionString)) 29 | { 30 | var dialog = new ConnectDialog(); 31 | dialog.ShowDialog(); 32 | ConnectionString = dialog.ConnectionString; 33 | 34 | if (String.IsNullOrEmpty(ConnectionString)) 35 | return; 36 | } 37 | 38 | Store = new QueryCostStore(new PlanParser(new QueryCostDataGateway(ConnectionString))); 39 | ShowCosts = false; //caller flips it first time used 40 | } 41 | 42 | public List GetCosts() 43 | { 44 | if (!ShowCosts || Store == null) 45 | return null; 46 | 47 | if (Dte == null || Dte.ActiveDocument == null || Dte.ActiveDocument.FullName == null) 48 | { 49 | return null; 50 | } 51 | 52 | var activeDocPath = Dte.ActiveDocument.FullName; 53 | var statements = Store.GetStatements(activeDocPath); 54 | return statements; 55 | } 56 | 57 | public void AddCosts(string script, Document doc) 58 | { 59 | if (!ShowCosts) 60 | return; 61 | 62 | if(Store == null) 63 | BuildStore(); 64 | 65 | if (Store == null) 66 | return; 67 | 68 | Store.AddStatements(script, doc.FullName); 69 | } 70 | 71 | public bool ShowCosts { get; set; } 72 | 73 | 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /src/Common/src/SSDTDevPack.Common/Rewriter/Replacements.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.SqlServer.TransactSql.ScriptDom; 2 | 3 | namespace SSDTDevPack.Rewriter 4 | { 5 | public struct Replacements 6 | { 7 | public string Original; 8 | public TSqlFragment OriginalFragment; 9 | public int OriginalLength; 10 | public int OriginalOffset; 11 | public string Replacement; 12 | } 13 | } -------------------------------------------------------------------------------- /src/Common/src/SSDTDevPack.Common/SolutionBrowser/SolutionBrowser.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace SSDTDevPack.Common.SolutionBrowser 8 | { 9 | public class SolutionBrowser 10 | { 11 | private readonly string _projectType; 12 | 13 | public SolutionBrowser(string projectType) 14 | { 15 | _projectType = projectType; 16 | } 17 | 18 | public string ChooseSolutionLocation() 19 | { 20 | return ""; 21 | } 22 | 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/Common/src/SSDTDevPack.Common/SolutionBrowser/SolutionBrowserForm.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Data; 5 | using System.Drawing; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Threading.Tasks; 9 | using System.Windows.Forms; 10 | using EnvDTE; 11 | using SSDTDevPack.Common.Enumerators; 12 | 13 | namespace SSDTDevPack.Common.SolutionBrowser 14 | { 15 | public partial class SolutionBrowserForm : Form 16 | { 17 | private static ProjectItem LastSelectedItem; 18 | 19 | public SolutionBrowserForm(string objectName, ProjectItem defaultSelectedItem = null) 20 | { 21 | InitializeComponent(); 22 | wpfSolutionBrowser1.Fill(this, ProjectType.SSDT, objectName, defaultSelectedItem ?? LastSelectedItem); 23 | } 24 | 25 | public string GetObjectName() 26 | { 27 | return wpfSolutionBrowser1.GetObjectName(); 28 | } 29 | 30 | public ProjectItem DestinationItem 31 | { 32 | get 33 | { 34 | LastSelectedItem = wpfSolutionBrowser1.GetDestinationItem(); 35 | 36 | return LastSelectedItem; 37 | } 38 | } 39 | 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/Common/src/SSDTDevPack.Common/SolutionBrowser/wpfSolutionBrowser.xaml: -------------------------------------------------------------------------------- 1 |  8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /src/Common/src/SSDTDevPack.Common/Ui/LabelWithProgressIndicator.xaml: -------------------------------------------------------------------------------- 1 |  9 | 10 | 11 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /src/Common/src/SSDTDevPack.Common/Ui/LabelWithProgressIndicator.xaml.cs: -------------------------------------------------------------------------------- 1 | using System.Windows; 2 | using System.Windows.Controls; 3 | using System.Windows.Input; 4 | using EnvDTE; 5 | using Microsoft.VisualStudio.Shell.Interop; 6 | using SSDTDevPack.Common.VSPackage; 7 | 8 | namespace SSDTDevPack.Common.Ui 9 | { 10 | /// 11 | /// Interaction logic for LabelWithProgressIndicator.xaml 12 | /// 13 | public partial class LabelWithProgressIndicator : UserControl 14 | { 15 | private readonly string _documentPath; 16 | private readonly string _label; 17 | private readonly double _progress; 18 | 19 | public LabelWithProgressIndicator() 20 | { 21 | InitializeComponent(); 22 | } 23 | 24 | public LabelWithProgressIndicator(string label, double progress, string documentPath = null) 25 | { 26 | InitializeComponent(); 27 | _label = label; 28 | _progress = progress; 29 | _documentPath = documentPath; 30 | } 31 | 32 | public void Configure() 33 | { 34 | Label.Text = _label; 35 | ToolTip = string.Format("{0}%", _progress); 36 | 37 | if (_progress == 0) 38 | { 39 | Background.Visibility = Visibility.Hidden; 40 | } 41 | else 42 | { 43 | Progress.Width = Background.Width*(_progress/100); 44 | } 45 | } 46 | 47 | private void Navigate(object sender, MouseButtonEventArgs e) 48 | { 49 | if (string.IsNullOrEmpty(_documentPath)) 50 | return; 51 | 52 | var dte = VsServiceProvider.Get(typeof (SDTE)) as DTE; 53 | 54 | dte?.Documents.Open(_documentPath); 55 | } 56 | 57 | private void CheckEnterAndNavigate(object sender, KeyEventArgs e) 58 | { 59 | if (e.Key == Key.Enter) 60 | Navigate(sender, null); 61 | } 62 | } 63 | } -------------------------------------------------------------------------------- /src/Common/src/SSDTDevPack.Common/VSPackage/DocumentExtensions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using EnvDTE; 7 | 8 | namespace SSDTDevPack.Common.VSPackage 9 | { 10 | public static class DocumentExtensions 11 | { 12 | public static string GetText(this Document source) 13 | { 14 | if (source == null) 15 | return null; //can this even happen? 16 | 17 | var doc = source.Object("TextDocument") as TextDocument; 18 | 19 | if (null == doc) 20 | { 21 | return null; 22 | } 23 | 24 | var ep = doc.StartPoint.CreateEditPoint(); 25 | ep.EndOfDocument(); 26 | 27 | var length = ep.AbsoluteCharOffset; 28 | ep.StartOfDocument(); 29 | return ep.GetText(length); 30 | } 31 | 32 | 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/Common/src/SSDTDevPack.Common/VSPackage/IVsServiceProvider.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace SSDTDevPack.Common.VSPackage 4 | { 5 | public interface IVsServiceProvider 6 | { 7 | object GetVsService(Type type); 8 | } 9 | } -------------------------------------------------------------------------------- /src/Common/src/SSDTDevPack.Common/VSPackage/ServiceProvider.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace SSDTDevPack.Common.VSPackage 4 | { 5 | public static class VsServiceProvider 6 | { 7 | private static IVsServiceProvider _provider; 8 | 9 | public static void Register(IVsServiceProvider provider) 10 | { 11 | _provider = provider; 12 | } 13 | 14 | public static object Get(Type type) 15 | { 16 | if (_provider == null) 17 | return null; 18 | 19 | return _provider.GetVsService(type); 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /src/Common/src/SSDTDevPack.Common/app.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /src/Common/src/SSDTDevPack.Common/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /src/Common/src/SSDTDevPack.Common/tSQLtStubber/Parameter.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.SqlServer.Dac.Model; 2 | 3 | namespace SSDTDevPack.tSQLtStubber 4 | { 5 | public class Parameter 6 | { 7 | public string Name; 8 | public SqlDataType Type; 9 | 10 | public Parameter(string name, SqlDataType type) 11 | { 12 | Name = name; 13 | Type = type; 14 | } 15 | } 16 | } -------------------------------------------------------------------------------- /src/Common/src/SSDTDevPack.Common/tSQLtStubber/ParametersHelper.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.SqlServer.TransactSql.ScriptDom; 2 | 3 | namespace SSDTDevPack.tSQLtStubber 4 | { 5 | public class ParametersHelper 6 | { 7 | public static ExecuteParameter CreateStoredProcedureParameter(string name, string value) 8 | { 9 | return new ExecuteParameter 10 | { 11 | Variable = new VariableReference 12 | { 13 | Name = name 14 | }, 15 | ParameterValue = new StringLiteral {Value = value} 16 | }; 17 | } 18 | 19 | public static ExecuteParameter CreateStoredProcedureParameter(string name, int value) 20 | { 21 | return new ExecuteParameter 22 | { 23 | Variable = new VariableReference 24 | { 25 | Name = name 26 | }, 27 | ParameterValue = new IntegerLiteral {Value = value.ToString()} 28 | }; 29 | } 30 | 31 | public static ExecuteParameter CreateStoredProcedureVariableParameter(string name) 32 | { 33 | return new ExecuteParameter 34 | { 35 | ParameterValue = new VariableReference 36 | { 37 | Name = name 38 | } 39 | }; 40 | } 41 | 42 | public static ExecuteParameter CreateStoredProcedureParameter(string value) 43 | { 44 | return new ExecuteParameter 45 | { 46 | ParameterValue = new StringLiteral 47 | { 48 | Value = value 49 | } 50 | }; 51 | } 52 | } 53 | } -------------------------------------------------------------------------------- /src/Common/src/SSDTDevPack.Common/tSQLtStubber/ProcedureVisitor.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using Microsoft.SqlServer.TransactSql.ScriptDom; 3 | 4 | namespace SSDTDevPack.tSQLtStubber 5 | { 6 | public class ProcedureVisitor : TSqlFragmentVisitor 7 | { 8 | public readonly List Procedures = new List(); 9 | public readonly List Functions = new List(); 10 | 11 | public override void Visit(CreateProcedureStatement node) 12 | { 13 | Procedures.Add(node); 14 | } 15 | 16 | public override void Visit(CreateFunctionStatement node) 17 | { 18 | Functions.Add(node); 19 | } 20 | } 21 | } -------------------------------------------------------------------------------- /src/Common/src/SSDTDevPack.Common/tSQLtStubber/ScriptBuilder.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using Microsoft.SqlServer.TransactSql.ScriptDom; 3 | using SSDTDevPack.Common.ProjectVersion; 4 | using SSDTDevPack.Common.Settings; 5 | 6 | namespace SSDTDevPack.tSQLtStubber 7 | { 8 | public class ScriptBuilder 9 | { 10 | protected string GenerateScript(TSqlFragment fragment) 11 | { 12 | string script; 13 | var generator = VersionDetector.ScriptGeneratorFactory(SavedSettings.Get().GeneratorOptions); 14 | generator.GenerateScript(fragment, out script); 15 | return script; 16 | } 17 | 18 | protected IList GetTokens(TSqlFragment fragment) 19 | { 20 | var generator = VersionDetector.ScriptGeneratorFactory(SavedSettings.Get().GeneratorOptions); 21 | return generator.GenerateTokens(fragment); 22 | } 23 | } 24 | } -------------------------------------------------------------------------------- /src/Common/src/SSDTDevPack.Logging/Key.snk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GoEddie/SSDT-DevPack/0915f2acf4add5482221ec6c8dd55c8ca34d0c52/src/Common/src/SSDTDevPack.Logging/Key.snk -------------------------------------------------------------------------------- /src/Common/src/SSDTDevPack.Logging/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("SSDTDevPack.Logging")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("SSDTDevPack.Logging")] 13 | [assembly: AssemblyCopyright("NO Copyright Ed Elliott 2015")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("d65837e8-b729-4a69-9283-2460dd288fee")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.9.23.1")] 36 | [assembly: AssemblyFileVersion("1.9.23.1")] 37 | -------------------------------------------------------------------------------- /src/Common/src/SSDTDevPack.Logging/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /src/Lib/DacFxStronglyTypedModel.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GoEddie/SSDT-DevPack/0915f2acf4add5482221ec6c8dd55c8ca34d0c52/src/Lib/DacFxStronglyTypedModel.dll -------------------------------------------------------------------------------- /src/Lib/DacFxStronglyTypedModel.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GoEddie/SSDT-DevPack/0915f2acf4add5482221ec6c8dd55c8ca34d0c52/src/Lib/DacFxStronglyTypedModel.pdb -------------------------------------------------------------------------------- /src/Merge/src/SSDTDevPack.Indexes/Key.snk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GoEddie/SSDT-DevPack/0915f2acf4add5482221ec6c8dd55c8ca34d0c52/src/Merge/src/SSDTDevPack.Indexes/Key.snk -------------------------------------------------------------------------------- /src/Merge/src/SSDTDevPack.Indexes/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("SSDTDevPack.Rewriter")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("Microsoft")] 12 | [assembly: AssemblyProduct("SSDTDevPack.Rewriter")] 13 | [assembly: AssemblyCopyright("Copyright © Microsoft 2015")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("e9e16fb1-2880-43f0-8ebc-41e69391b810")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.9.23.1")] 36 | [assembly: AssemblyFileVersion("1.9.23.1")] 37 | -------------------------------------------------------------------------------- /src/Merge/src/SSDTDevPack.Indexes/app.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /src/Merge/src/SSDTDevPack.Indexes/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /src/Merge/src/SSDTDevPack.Merge/069085-black-paint-splatter-icon-alphanumeric-letter-m readme.txt: -------------------------------------------------------------------------------- 1 | Thanks for downloading! 2 | 3 | For licensing and FAQs please see our online readme: 4 | http://mysitemyway.com/etc-readme/ 5 | 6 | All icons, patterns, brushes, custom shapes, layer styles, layered PSDs, patterns, textures, web elements, and other design resources on this website are free for use in both personal and commercial projects. 7 | 8 | You may use them freely in software programs, iPhone skins, scrap-booking kits, web templates, Themeforest themes, websites, blogs, print on demand sites such as Zazzle, movies, video games, and virtual worlds such as SecondLife, etc. -------------------------------------------------------------------------------- /src/Merge/src/SSDTDevPack.Merge/069085-black-paint-splatter-icon-alphanumeric-letter-m.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GoEddie/SSDT-DevPack/0915f2acf4add5482221ec6c8dd55c8ca34d0c52/src/Merge/src/SSDTDevPack.Merge/069085-black-paint-splatter-icon-alphanumeric-letter-m.ico -------------------------------------------------------------------------------- /src/Merge/src/SSDTDevPack.Merge/Key.snk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GoEddie/SSDT-DevPack/0915f2acf4add5482221ec6c8dd55c8ca34d0c52/src/Merge/src/SSDTDevPack.Merge/Key.snk -------------------------------------------------------------------------------- /src/Merge/src/SSDTDevPack.Merge/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("SSDTDevPack.Merge")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("SSDTDevPack.Merge")] 13 | [assembly: AssemblyCopyright("NO Copyright Ed Elliott 2015")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("2cadb850-5531-4e54-ab17-9b8940aebec2")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.9.23.1")] 36 | [assembly: AssemblyFileVersion("1.9.23.1")] 37 | -------------------------------------------------------------------------------- /src/Merge/src/SSDTDevPack.Merge/app.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /src/Merge/src/SSDTDevPack.Merge/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /src/Merge/src/SSDTDevPack.VSPackage/CheckableCommand.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel.Design; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | using Microsoft.VisualStudio.Shell; 8 | 9 | namespace TheAgileSQLClub.SSDTDevPack_VSPackage 10 | { 11 | 12 | 13 | } 14 | -------------------------------------------------------------------------------- /src/Merge/src/SSDTDevPack.VSPackage/CodeCoverageToolWindow.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.InteropServices; 2 | using Microsoft.VisualStudio.Shell; 3 | using SSDTDevPacl.CodeCoverage.Lib.Ui; 4 | 5 | namespace TheAgileSQLClub.SSDTDevPack_VSPackage 6 | { 7 | /// 8 | /// This class implements the tool window exposed by this package and hosts a user control. 9 | /// In Visual Studio tool windows are composed of a frame (implemented by the shell) and a pane, 10 | /// usually implemented by the package implementer. 11 | /// This class derives from the ToolWindowPane class provided from the MPF in order to use its 12 | /// implementation of the IVsUIElementPane interface. 13 | /// 14 | [Guid("978c49d6-2808-4a7a-bf32-274bec0EDD1E")] 15 | public class CodeCoverageToolWindow : ToolWindowPane 16 | { 17 | /// 18 | /// Standard constructor for the tool window. 19 | /// 20 | public CodeCoverageToolWindow() : 21 | base(null) 22 | { 23 | // Set the window title reading it from the resources. 24 | Caption = "Code Coverage"; 25 | // Set the image that will appear on the tab of the window frame 26 | // when docked with an other window 27 | // The resource ID correspond to the one defined in the resx file 28 | // while the Index is the offset in the bitmap strip. Each image in 29 | // the strip being 16x16. 30 | // BitmapResourceID = 301; 31 | // BitmapIndex = 1; 32 | Content = new CodeCoverageWindow(); 33 | } 34 | 35 | protected override void OnCreate() 36 | { 37 | base.OnCreate(); 38 | } 39 | 40 | protected override void OnClose() 41 | { 42 | base.OnClose(); 43 | } 44 | } 45 | } -------------------------------------------------------------------------------- /src/Merge/src/SSDTDevPack.VSPackage/GlobalSuppressions.cs: -------------------------------------------------------------------------------- 1 | // This file is used by Code Analysis to maintain SuppressMessage 2 | // attributes that are applied to this project. Project-level 3 | // suppressions either have no target or are given a specific target 4 | // and scoped to a namespace, type, member, etc. 5 | // 6 | // To add a suppression to this file, right-click the message in the 7 | // Error List, point to "Suppress Message(s)", and click "In Project 8 | // Suppression File". You do not need to add suppressions to this 9 | // file manually. 10 | 11 | [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1017:MarkAssembliesWithComVisible")] 12 | -------------------------------------------------------------------------------- /src/Merge/src/SSDTDevPack.VSPackage/Guids.cs: -------------------------------------------------------------------------------- 1 | // Guids.cs 2 | // MUST match guids.h 3 | using System; 4 | 5 | namespace TheAgileSQLClub.SSDTDevPack_VSPackage 6 | { 7 | static class GuidList 8 | { 9 | public const string guidSSDTDevPack_VSPackagePkgString = "354e4235-c369-4a8f-a855-0318891c0903"; 10 | public const string guidSSDTDevPack_VSPackageCmdSetString = "a60f097a-ca84-43f0-b08d-a45b6ccd476a"; 11 | public const string guidToolWindowPersistanceString = "978c49d6-2808-4a7a-bf32-274bec085942"; 12 | public const string guidCodeCoverageWindowPersistanceString = "978c49d6-2808-4a7a-bf32-274bec0EDD1E"; 13 | public static readonly Guid guidSSDTDevPack_VSPackageCmdSet = new Guid(guidSSDTDevPack_VSPackageCmdSetString); 14 | }; 15 | } -------------------------------------------------------------------------------- /src/Merge/src/SSDTDevPack.VSPackage/Key.snk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GoEddie/SSDT-DevPack/0915f2acf4add5482221ec6c8dd55c8ca34d0c52/src/Merge/src/SSDTDevPack.VSPackage/Key.snk -------------------------------------------------------------------------------- /src/Merge/src/SSDTDevPack.VSPackage/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Ed Elliott 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /src/Merge/src/SSDTDevPack.VSPackage/MergeToolWindow.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.InteropServices; 2 | using Microsoft.VisualStudio.Shell; 3 | using SSDTDevPack.Merge.UI; 4 | 5 | namespace TheAgileSQLClub.SSDTDevPack_VSPackage 6 | { 7 | /// 8 | /// This class implements the tool window exposed by this package and hosts a user control. 9 | /// In Visual Studio tool windows are composed of a frame (implemented by the shell) and a pane, 10 | /// usually implemented by the package implementer. 11 | /// This class derives from the ToolWindowPane class provided from the MPF in order to use its 12 | /// implementation of the IVsUIElementPane interface. 13 | /// 14 | [Guid("978c49d6-2808-4a7a-bf32-274bec085942")] 15 | public class MergeToolWindow : ToolWindowPane 16 | { 17 | /// 18 | /// Standard constructor for the tool window. 19 | /// 20 | public MergeToolWindow() : 21 | base(null) 22 | { 23 | // Set the window title reading it from the resources. 24 | Caption = Resources.ToolWindowTitle; 25 | // Set the image that will appear on the tab of the window frame 26 | // when docked with an other window 27 | // The resource ID correspond to the one defined in the resx file 28 | // while the Index is the offset in the bitmap strip. Each image in 29 | // the strip being 16x16. 30 | BitmapResourceID = 301; 31 | BitmapIndex = 1; 32 | 33 | // This is the user control hosted by the tool window; Note that, even if this class implements IDisposable, 34 | // we are not calling Dispose on this object. This is because ToolWindowPane calls Dispose on 35 | // the object returned by the Content property. 36 | Content = new MainWindow(); 37 | } 38 | 39 | protected override void OnCreate() 40 | { 41 | base.OnCreate(); 42 | } 43 | 44 | protected override void OnClose() 45 | { 46 | base.OnClose(); 47 | } 48 | } 49 | } -------------------------------------------------------------------------------- /src/Merge/src/SSDTDevPack.VSPackage/MyControl.xaml: -------------------------------------------------------------------------------- 1 |  11 | 12 | 13 | MergeUi 14 |