Skip to content

Commit 243056e

Browse files
author
Gert Marginet
committed
Update Community.VisualStudio.Toolkit nuget, and Readme
1 parent 19745ef commit 243056e

File tree

8 files changed

+38
-3
lines changed

8 files changed

+38
-3
lines changed

README.md

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,11 @@ The connection string can be set in the .csproj file you just added the sql file
3636

3737
![image](https://github.com/gmarginet/SqlQueryTools/blob/master/art/ConnectionString.png?raw=true)
3838

39+
As of version 1.4 you can use the the properties window to edit the connection string, you just need to select the project file in the sollution explorer and open the properties window.
40+
41+
![image](https://github.com/gmarginet/SqlQueryTools/blob/master/art/ConnectionString_PropertiesWindow.png?raw=true)
42+
43+
3944
Now you can start writing your sql query.
4045
You can remove all comments but if you use parameters in your query you should put the parameter declarations above the 'End Of Parameter Declaration' marker.
4146
And your actual query below the marker.
@@ -62,10 +67,39 @@ The solution explorer will now look like this.
6267
![image](https://github.com/gmarginet/SqlQueryTools/blob/master/art/SolutionExplorer.png?raw=true)
6368

6469
If you don't like the file suffixes or the parameter declaration marker.
65-
These can be changed via 'Tools/Options/SqlQueryTools
70+
These can be changed via 'Tools/Options/SqlQueryTools'
6671

6772
![image](https://github.com/gmarginet/SqlQueryTools/blob/master/art/Options.png?raw=true)
6873

74+
### Parameters
75+
76+
By default SqlQueryTools was generating const fields for every parameter that you declared in the parameter declaration section.
77+
78+
As of version 1.4 this can be turned of in the properties window while the sql file is selected in the solution explorer.
79+
80+
![image](https://github.com/gmarginet/SqlQueryTools/blob/master/art/Sql_ParametersWindow.png?raw=true)
81+
82+
In 'Tools/Options/SqlQueryTools' you can change the default for new files that are created with the SqlQueryTools 'Add Sql File' context menu item.
83+
84+
![image](https://github.com/gmarginet/SqlQueryTools/blob/master/art/Options_Extra.png?raw=true)
85+
86+
### Poco class
87+
88+
From version 1.4 you can also ask SqlQueryTools to generate a poco class for the result that you get back from your query.
89+
90+
Lets use the following sql as an example
91+
92+
![image](https://github.com/gmarginet/SqlQueryTools/blob/master/art/ExampleSql_Poco.png?raw=true)
93+
94+
The code generated for this sql with 'Generate Poco' turned on would be the following:
95+
96+
![image](https://github.com/gmarginet/SqlQueryTools/blob/master/art/ExampleCode_Poco.png?raw=true)
97+
98+
You can turn on this feature at sql file level by using the properties window of the file, or change the default for new files via 'Tools/Options/SqlQueryTools'.
99+
100+
101+
102+
69103
### License
70104

71105
MIT
11.5 KB
Loading

art/ExampleCode_Poco.png

43.3 KB
Loading

art/ExampleSql_Poco.png

30.4 KB
Loading

art/Options_Extra.png

60.5 KB
Loading

art/Sql_ParametersWindow.png

10.4 KB
Loading

src/SqlQueryTools/FileHandlers/SqlSaveHandler.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,6 @@ private async Task GenerateSqlConstStringAsync(string inputFilePath)
247247
}
248248

249249
contentBuilder.AppendLine($"\t}}");
250-
contentBuilder.AppendLine($"}}");
251250

252251
var generatePocoClass = await inputPhysicalFile.GetGeneratePocoClassAsync(options.GeneratePocoClass);
253252
if (generatePocoClass)
@@ -267,6 +266,8 @@ private async Task GenerateSqlConstStringAsync(string inputFilePath)
267266
contentBuilder.AppendLine($"\t}}");
268267
}
269268

269+
contentBuilder.AppendLine($"}}");
270+
270271
var newFileName = $"{inputFileNameWithoutSuffix}{options.CodeFileSuffix}";
271272
var newFilePath = Path.Combine(inputFileDirectory, newFileName);
272273

src/SqlQueryTools/SqlQueryTools.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@
121121
</ItemGroup>
122122
<ItemGroup>
123123
<PackageReference Include="Community.VisualStudio.Toolkit.17">
124-
<Version>17.0.478</Version>
124+
<Version>17.0.482</Version>
125125
</PackageReference>
126126
<PackageReference Include="Community.VisualStudio.VSCT" Version="16.0.29.6" PrivateAssets="all" />
127127
<PackageReference Include="Dapper">

0 commit comments

Comments
 (0)