Skip to content

Commit a6676be

Browse files
author
DAIKOZ
committed
SQLWrapper 2.2.4
1 parent acbb191 commit a6676be

9 files changed

Lines changed: 147 additions & 81 deletions

File tree

Daikoz.SQLWrapper/Daikoz.SQLWrapper.csproj

Lines changed: 47 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -2,35 +2,57 @@
22

33
<PropertyGroup>
44
<TargetFramework>netstandard2.0</TargetFramework>
5+
<PlatformTarget>x64</PlatformTarget>
6+
<Nullable>enable</Nullable>
57
<EnforceCodeStyleInBuild>True</EnforceCodeStyleInBuild>
8+
<AnalysisMode>All</AnalysisMode>
69
<EnableNETAnalyzers>True</EnableNETAnalyzers>
710
<AnalysisLevel>latest</AnalysisLevel>
811
<LangVersion>latest</LangVersion>
9-
<Nullable>enable</Nullable>
1012

1113
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
1214
<PackageIcon>sqlwrapper.png</PackageIcon>
1315
<Title>SQL Wrapper Generator</Title>
14-
<Version>2.2.1</Version>
15-
<AssemblyVersion>2.2.1</AssemblyVersion>
16-
<FileVersion>2.2.1</FileVersion>
16+
<Version>2.2.4</Version>
17+
<AssemblyVersion>2.2.4</AssemblyVersion>
18+
<FileVersion>2.2.4</FileVersion>
1719
<Authors>DAIKOZ</Authors>
18-
<Description>SQLWrapper makes it easier to create code wrappers for SQL queries. It's a powerful tool that helps speed up development by reducing the need for manual coding. It works with databases various SQL database (MySQL, MariaDB, ...), checking the syntax and performance of SQL queries before you execute them.
19-
20-
It's important to note that SQLWrapper isn't like other tools that map objects to database tables (ORMs). Instead, it directly generates code from your SQL queries and database structure, which performs better than tools like LINQ, EntityFramework, dapper, ... and doesn't have the same limitations.
21-
22-
One feature is that it can look at your database's structure to check if your SQL queries are correct, and it can create an XML file listing all the data your queries need and return. Then, you can use XSLT templates to turn that XML into code in languages like C#, and more.
23-
24-
Overall, DAIKOZ.SQLWrapper is a handy tool for making SQL code easier to work with, saving time, and helping you write better code.</Description>
20+
<Description>SQLWrapper makes it easier to create code wrappers for SQL queries. It's a
21+
powerful tool that helps speed up development by reducing the need for manual coding. It
22+
works with databases various SQL database (MySQL, MariaDB, ...), checking the syntax and
23+
performance of SQL queries before you execute them.
24+
25+
It's important to note that SQLWrapper isn't like other tools that map objects to
26+
database tables (ORMs). Instead, it directly generates code from your SQL queries and
27+
database structure, which performs better than tools like LINQ, EntityFramework, dapper,
28+
... and doesn't have the same limitations.
29+
30+
One feature is that it can look at your database's structure to check if your SQL
31+
queries are correct, and it can create an XML file listing all the data your queries
32+
need and return. Then, you can use XSLT templates to turn that XML into code in
33+
languages like C#, and more.
34+
35+
Overall, DAIKOZ.SQLWrapper is a handy tool for making SQL code easier to work with,
36+
saving time, and helping you write better code.</Description>
2537
<Copyright>Copyright (c) DAIKOZ. All rights reserved.</Copyright>
2638
<PackageProjectUrl>https://www.sqlwrapper.com</PackageProjectUrl>
2739
<PackageReadmeFile>readme.md</PackageReadmeFile>
2840
<RepositoryUrl>https://github.com/daikoz/SQLWrapper</RepositoryUrl>
2941
<RepositoryType>github</RepositoryType>
30-
<PackageTags>sql;wrapper;sqlwrapper;ORM;dapper;linq;database;mysql;mariadb;server;mssql;pgsql;sqlite;postgres;postgresql;query;builder</PackageTags>
42+
<PackageTags>
43+
sql;wrapper;sqlwrapper;ORM;dapper;linq;database;mysql;mariadb;server;mssql;pgsql;sqlite;postgres;postgresql;query;builder</PackageTags>
3144
<PackageReleaseNotes>
3245
# Changelog
3346

47+
## [2.2.4] (2027-02-20)
48+
- Fix minor: verbose no take account in some case.
49+
50+
## [2.2.3] (2026-02-15)
51+
- Don't copy Daikoz.SQLWrapper.dll and sqlwrapper.json in output directory. It is usesuf only for buildtime.
52+
53+
## [2.2.2] (2025-11-01)
54+
- Update nuget packages followed security issue.
55+
3456
## [2.2.1] (2025-04-20)
3557

3658
### SQLWrapper
@@ -39,29 +61,31 @@ Overall, DAIKOZ.SQLWrapper is a handy tool for making SQL code easier to work wi
3961
<PackageLicenseFile>license.txt</PackageLicenseFile>
4062
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
4163

64+
<SuppressDependenciesWhenPacking>true</SuppressDependenciesWhenPacking>
65+
<IncludeBuildOutput>false</IncludeBuildOutput>
4266
</PropertyGroup>
4367

4468
<Target Name="PostClean" AfterTargets="Clean">
45-
<RemoveDir Directories="$(BaseOutputPath)" />
46-
<RemoveDir Directories="$(BaseIntermediateOutputPath)" />
69+
<RemoveDir Directories="$(MSBuildProjectDirectory)\$(BaseOutputPath)" />
70+
<RemoveDir Directories="$(MSBuildProjectDirectory)\$(BaseIntermediateOutputPath)" />
4771
</Target>
4872

49-
<ItemGroup>
50-
<Content Include="build\*.targets" PackagePath="build\" />
51-
</ItemGroup>
52-
53-
<ItemGroup>
54-
<Content Include="tools/**/*.*" PackagePath="tools\" />
55-
</ItemGroup>
73+
<Target Name="CopyReadme" BeforeTargets="BeforeBuild">
74+
<Copy SourceFiles="..\..\..\SQLWrapper\README.md" DestinationFolder="$(MSBuildProjectDirectory)" />
75+
</Target>
5676

5777
<ItemGroup>
5878
<None Include="..\..\Web\SQLWrapper.com\wwwroot\img\sqlwrapper.png" Pack="true" PackagePath="\" />
5979
<None Include="readme.md" Pack="true" PackagePath="\" />
6080
<None Include="license.txt" Pack="true" PackagePath="\" />
81+
<Content Include="build\*.targets" PackagePath="build" />
82+
<Content Include="build\*.props" PackagePath="build" />
83+
<None Include="$(OutputPath)$(AssemblyName).dll" Pack="true" PackagePath="build" />
84+
<Content Include="tools/**/*.*" PackagePath="tools\" />
6185
</ItemGroup>
6286

6387
<ItemGroup>
64-
<PackageReference Include="Microsoft.Build.Utilities.Core" Version="17.12.6" />
88+
<PackageReference Include="Microsoft.Build.Utilities.Core" Version="18.0.2" />
6589
</ItemGroup>
6690

6791
<ItemGroup>
@@ -79,8 +103,4 @@ Overall, DAIKOZ.SQLWrapper is a handy tool for making SQL code easier to work wi
79103
</EmbeddedResource>
80104
</ItemGroup>
81105

82-
<Target Name="CopyReadme" BeforeTargets="BeforeBuild">
83-
<Copy SourceFiles="..\..\..\SQLWrapper\README.md" DestinationFolder="$(MSBuildProjectDirectory)" />
84-
</Target>
85-
86-
</Project>
106+
</Project>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// This file is used by Code Analysis to maintain SuppressMessage
2+
// attributes that are applied to this project.
3+
// Project-level suppressions either have no target or are given
4+
// a specific target and scoped to a namespace, type, member, etc.
5+
6+
using System.Diagnostics.CodeAnalysis;
7+
8+
[assembly: SuppressMessage("Performance", "CA1812:Avoid uninstantiated internal classes", Justification = "Use for XML serialisation", Scope = "type", Target = "~T:Daikoz.SQLWrapper.Schema")]
9+
[assembly: SuppressMessage("Performance", "CA1812:Avoid uninstantiated internal classes", Justification = "Use for XML serialisation", Scope = "type", Target = "~T:Daikoz.SQLWrapper.Database")]
10+
[assembly: SuppressMessage("Performance", "CA1812:Avoid uninstantiated internal classes", Justification = "Use for XML serialisation", Scope = "type", Target = "~T:Daikoz.SQLWrapper.SQL")]
11+
[assembly: SuppressMessage("Performance", "CA1812:Avoid uninstantiated internal classes", Justification = "Use for XML serialisation", Scope = "type", Target = "~T:Daikoz.SQLWrapper.Wrapper")]
12+
[assembly: SuppressMessage("Performance", "CA1812:Avoid uninstantiated internal classes", Justification = "Use for XML serialisation", Scope = "type", Target = "~T:Daikoz.SQLWrapper.SQLWrapperConfig")]
13+
14+
[assembly: SuppressMessage("Usage", "CA2227:Collection properties should be read only", Justification = "Use by target", Scope = "member", Target = "~P:Daikoz.SQLWrapper.SQLWrapperTask.GeneratedSources")]

Daikoz.SQLWrapper/SQLWrapperException.cs

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,30 @@
22

33
namespace Daikoz.SQLWrapper
44
{
5-
internal class SQLWrapperException(string errorCode, string file, string errorMessage) : Exception
5+
public class SQLWrapperException : Exception
66
{
7-
public string ErrorCode { get; set; } = errorCode;
8-
public string File { get; set; } = file;
9-
public string ErrorMessage { get; set; } = errorMessage;
7+
public string ErrorCode { get; set; } = "";
8+
public string File { get; set; } = "";
9+
public string ErrorMessage { get; set; } = "";
10+
11+
public SQLWrapperException()
12+
{
13+
}
14+
15+
public SQLWrapperException(string message) : base(message)
16+
{
17+
}
18+
19+
public SQLWrapperException(string message, Exception innerException) : base(message, innerException)
20+
{
21+
}
22+
23+
public SQLWrapperException(string errorCode, string file, string errorMessage)
24+
{
25+
ErrorCode = errorCode;
26+
File = file;
27+
ErrorMessage = errorMessage;
28+
}
29+
1030
}
1131
}

Daikoz.SQLWrapper/SQLWrapperLauncher.cs

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
using Microsoft.Build.Utilities;
33
using System;
44
using System.Collections.Generic;
5+
using System.Collections.ObjectModel;
56
using System.Diagnostics;
67
using System.Globalization;
78
using System.IO;
@@ -13,9 +14,9 @@
1314

1415
namespace Daikoz.SQLWrapper
1516
{
16-
public class SQLWrapperLauncher
17+
internal class SQLWrapperLauncher
1718
{
18-
public enum LanguageTarget
19+
internal enum LanguageTarget
1920
{
2021
csharp,
2122
visualbasic,
@@ -54,14 +55,14 @@ public SQLWrapperLauncher(string configurationFilePath, string rootNamespace, Ta
5455
if (config is SQLWrapperConfig sqlConfig)
5556
_Config = sqlConfig;
5657
else
57-
throw new Exception();
58+
throw new InvalidOperationException();
5859
}
5960

6061
_ConfigurationModifiedDate = new FileInfo(configurationFilePath).LastWriteTimeUtc;
6162
}
6263
catch (Exception ex)
6364
{
64-
throw new SQLWrapperException(ErrorMessage.MsgConfigurationWrong.ErrorCode, configurationFilePath, String.Format(ErrorMessage.MsgConfigurationWrong.Message, ex.Message));
65+
throw new SQLWrapperException(ErrorMessage.MsgConfigurationWrong.ErrorCode, configurationFilePath, string.Format(ErrorMessage.MsgConfigurationWrong.Message, ex.Message));
6566
}
6667
}
6768

@@ -73,7 +74,7 @@ private void LogMessage(string message)
7374

7475
private static string DefaultDatabaseFilePath(string databaseName)
7576
{
76-
return Path.Combine(System.Environment.CurrentDirectory, "obj", databaseName + ".sqlwrapper.db");
77+
return Path.Combine(Environment.CurrentDirectory, "obj", databaseName + ".sqlwrapper.db");
7778
}
7879

7980
private string GetDatabaseFilePath(string? databaseName)
@@ -101,7 +102,7 @@ private static string GetAssemblyDirectory()
101102
if (!Directory.Exists(Path.Combine(assemblyDirectory, "tools")))
102103
{
103104
// nuget
104-
assemblyDirectory = Path.Combine(assemblyDirectory, "..", "..");
105+
assemblyDirectory = Path.Combine(assemblyDirectory, "..");
105106
}
106107
return assemblyDirectory;
107108
}
@@ -150,7 +151,7 @@ private void StartProcess(string arguments, string logCategory, string logFile)
150151
else
151152
sqlWrapperPath = Path.Combine(sqlWrapperPath, "linux-x64", "SQLWrapper");
152153
if (!File.Exists(sqlWrapperPath))
153-
throw new SQLWrapperException(ErrorMessage.MsgConfigurationSQLWrapperToolNotFound.ErrorCode, logFile, String.Format(ErrorMessage.MsgConfigurationSQLWrapperToolNotFound.Message, sqlWrapperPath));
154+
throw new SQLWrapperException(ErrorMessage.MsgConfigurationSQLWrapperToolNotFound.ErrorCode, logFile, string.Format(ErrorMessage.MsgConfigurationSQLWrapperToolNotFound.Message, sqlWrapperPath));
154155

155156
LogMessage(string.Format("Launch sqlwrapper: '{0} {1}'", sqlWrapperPath, arguments));
156157

@@ -239,7 +240,7 @@ private void StartProcess(string arguments, string logCategory, string logFile)
239240
throw new SQLWrapperException(code, logFile, error.Trim());
240241
}
241242
else
242-
throw new SQLWrapperException(ErrorMessage.MsgSQLWrapperExecution.ErrorCode, logFile, String.Format(ErrorMessage.MsgSQLWrapperExecution.Message, standartError));
243+
throw new SQLWrapperException(ErrorMessage.MsgSQLWrapperExecution.ErrorCode, logFile, string.Format(ErrorMessage.MsgSQLWrapperExecution.Message, standartError));
243244
}
244245

245246
}
@@ -259,7 +260,7 @@ private void CacheDatabase(Schema schema)
259260
cacheFilePath = DefaultDatabaseFilePath(schema.Name);
260261

261262
if (!Path.IsPathRooted(cacheFilePath))
262-
cacheFilePath = Path.Combine(System.Environment.CurrentDirectory, cacheFilePath);
263+
cacheFilePath = Path.Combine(Environment.CurrentDirectory, cacheFilePath);
263264

264265
LogMessage("Cache Database in '" + cacheFilePath + "'");
265266
if (_IsCleanning)
@@ -320,7 +321,7 @@ private void GenerateHelper(Database wrapperdb)
320321

321322
string outputFilePath = wrapperdb.OutputFilePath;
322323
if (!Path.IsPathRooted(outputFilePath))
323-
outputFilePath = Path.Combine(System.Environment.CurrentDirectory, outputFilePath);
324+
outputFilePath = Path.Combine(Environment.CurrentDirectory, outputFilePath);
324325

325326
// Cleaning
326327
if (_IsCleanning)

Daikoz.SQLWrapper/SQLWrapperTask.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
using Microsoft.Build.Framework;
22
using Microsoft.Build.Utilities;
33
using System;
4+
using System.Collections.ObjectModel;
45
using System.IO;
5-
using static Daikoz.SQLWrapper.SQLWrapperLauncher;
66

77
namespace Daikoz.SQLWrapper
88
{
@@ -41,12 +41,12 @@ public override bool Execute()
4141
".fsharp" => SQLWrapperLauncher.LanguageTarget.fsharp,
4242
_ => SQLWrapperLauncher.LanguageTarget.csharp,
4343
};
44-
Daikoz.SQLWrapper.SQLWrapperLauncher sqlWrapper = new(ConfigurationFilePath, RootNamespace, Log, IsCleanning, languageTarget);
44+
SQLWrapperLauncher sqlWrapper = new(ConfigurationFilePath, RootNamespace, Log, IsCleanning, languageTarget);
4545
bool result = sqlWrapper.Execute();
4646
GeneratedSources = [.. sqlWrapper.GeneratedSources];
4747
return result;
4848
}
49-
catch (Daikoz.SQLWrapper.SQLWrapperException ex)
49+
catch (SQLWrapperException ex)
5050
{
5151
Log.LogError(ErrorMessage.Category, ex.ErrorCode, "", "", ex.File, 0, 0, 0, 0, ex.ErrorMessage.Trim(), null);
5252
}
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
4+
<!--
5+
Don't copy DLL to output directory
6+
-->
7+
<ItemGroup>
8+
<PackageReference Update="Daikoz.SQLWrapper" PrivateAssets="All" />
9+
</ItemGroup>
10+
11+
<!--
12+
Visual Studio has its own incremental build logic on top of MSBuild's that
13+
will skip targets if it thinks inputs haven't changed. SQL file are not included
14+
in projet. Add DisableFastUpToDateCheck to force to call task each time.
15+
-->
16+
<PropertyGroup>
17+
<DisableFastUpToDateCheck>True</DisableFastUpToDateCheck>
18+
</PropertyGroup>
19+
20+
<!--
21+
Add cs/vb file under .sql or mysql file
22+
-->
23+
<ItemGroup>
24+
<Compile Update="**\*.mysql.cs">
25+
<DependentUpon>$([System.String]::Copy('%(Filename)'))</DependentUpon>
26+
</Compile>
27+
<Compile Update="**\*.sql.cs">
28+
<DependentUpon>$([System.String]::Copy('%(Filename)'))</DependentUpon>
29+
</Compile>
30+
<Compile Update="**\*.mysql.vb">
31+
<DependentUpon>$([System.String]::Copy('%(Filename)'))</DependentUpon>
32+
</Compile>
33+
<Compile Update="**\*.sql.vb">
34+
<DependentUpon>$([System.String]::Copy('%(Filename)'))</DependentUpon>
35+
</Compile>
36+
</ItemGroup>
37+
38+
</Project>
Lines changed: 10 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,10 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
33

4-
<!--
5-
Don t copy DLL to output directory
6-
-->
7-
<ItemGroup>
8-
<PackageReference Update="Daikoz.SQLWrapper" ExcludeAssets="runtime" />
9-
</ItemGroup>
10-
11-
<!--
12-
Visual Studio has its own incremental build logic on top of MSBuild's that
13-
will skip targets if it thinks inputs haven't changed. SQL file are not included
14-
in projet. Add DisableFastUpToDateCheck to force to call task each time.
15-
-->
16-
<PropertyGroup>
17-
<DisableFastUpToDateCheck>True</DisableFastUpToDateCheck>
18-
</PropertyGroup>
19-
20-
<!--
21-
Add cs/vb file under .sql or mysql file
22-
-->
23-
<ItemGroup>
24-
<Compile Update="**\*.mysql.cs">
25-
<DependentUpon>$([System.String]::Copy('%(Filename)'))</DependentUpon>
26-
</Compile>
27-
<Compile Update="**\*.sql.cs">
28-
<DependentUpon>$([System.String]::Copy('%(Filename)'))</DependentUpon>
29-
</Compile>
30-
<Compile Update="**\*.mysql.vb">
31-
<DependentUpon>$([System.String]::Copy('%(Filename)'))</DependentUpon>
32-
</Compile>
33-
<Compile Update="**\*.sql.vb">
34-
<DependentUpon>$([System.String]::Copy('%(Filename)'))</DependentUpon>
35-
</Compile>
36-
</ItemGroup>
37-
384
<!--
395
Tasks
406
-->
41-
<UsingTask TaskName="Daikoz.SQLWrapper.SQLWrapperTask" AssemblyFile="..\lib\netstandard2.0\Daikoz.SQLWrapper.dll" />
7+
<UsingTask TaskName="Daikoz.SQLWrapper.SQLWrapperTask" AssemblyFile="..\build\Daikoz.SQLWrapper.dll" />
428

439
<Target Name="SQLWrapperBuild" BeforeTargets="CoreCompile">
4410
<Daikoz.SQLWrapper.SQLWrapperTask ConfigurationFilePath="$(MSBuildProjectDirectory)\sqlwrapper.json" IsCleanning="false" RootNamespace="$(RootNamespace)" LanguageTarget="$(MSBuildProjectExtension)">
@@ -49,8 +15,15 @@
4915
</ItemGroup>
5016
</Target>
5117

52-
<Target Name="SQLWrapperClean" AfterTargets="BeforeClean">
18+
<Target Name="SQLWrapperClean" AfterTargets="CoreClean">
5319
<Daikoz.SQLWrapper.SQLWrapperTask ConfigurationFilePath="$(MSBuildProjectDirectory)\sqlwrapper.json" IsCleanning="true" RootNamespace="$(RootNamespace)" LanguageTarget="$(MSBuildProjectExtension)" />
5420
</Target>
5521

56-
</Project>
22+
<Target Name="SQLWrapperConfiguration" AfterTargets="AfterBuild">
23+
<ItemGroup>
24+
<FilesToDelete Include="$(OutDir)sqlwrapper.json" />
25+
</ItemGroup>
26+
<Delete Files="@(FilesToDelete)" />
27+
</Target>
28+
29+
</Project>
-1.95 MB
Binary file not shown.
-210 KB
Binary file not shown.

0 commit comments

Comments
 (0)