Skip to content

Commit

Permalink
Merge pull request #1 from ObjectivityLtd/Unpac_a_DAC_Package
Browse files Browse the repository at this point in the history
unpack a DACPAC file
  • Loading branch information
raczeja authored Oct 27, 2023
2 parents d4af8a1 + a78cc13 commit cc070b4
Show file tree
Hide file tree
Showing 7 changed files with 603 additions and 5 deletions.
167 changes: 167 additions & 0 deletions DBTestCompareGenerator/Configuration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,173 @@ public static string ConnectionString
get { return Configuration.Builder["appSettings:ConnectionStrings:DB"]; }
}

public static string DacpacFolder
{
get
{
string setting = null;
setting = Configuration.Builder["appSettings:DacpacFolder"];
Logger.Trace(CultureInfo.CurrentCulture, "DacpacFolder Folder value from settings file '{0}'", setting);
return setting;
}
}

public static string Database
{
get { return Configuration.Builder["appSettings:Database"]; }
}

public static string FolderPath
{
get
{
string setting = null;
setting = Configuration.Builder["appSettings:Folder"];
Logger.Trace(CultureInfo.CurrentCulture, "Folder value from settings file '{0}'", setting);
return setting;
}
}

public static bool ExtractAllTableData
{
get
{
var setting = Configuration.Builder["appSettings:ExtractAllTableData"];
Logger.Trace(CultureInfo.CurrentCulture, "Read ExtractAllTableData '{0}'", setting);
if (string.IsNullOrEmpty(setting))
{
return false;
}

if (setting.ToLower(CultureInfo.CurrentCulture).Equals("true"))
{
return true;
}

return false;
}
}

public static bool ExtractApplicationScopedObjectsOnly
{
get
{
var setting = Configuration.Builder["appSettings:ExtractApplicationScopedObjectsOnly"];
Logger.Trace(CultureInfo.CurrentCulture, "Read ExtractApplicationScopedObjectsOnly '{0}'", setting);
if (string.IsNullOrEmpty(setting))
{
return false;
}

if (setting.ToLower(CultureInfo.CurrentCulture).Equals("true"))
{
return true;
}

return false;
}
}

public static bool VerifyExtraction
{
get
{
var setting = Configuration.Builder["appSettings:VerifyExtraction"];
Logger.Trace(CultureInfo.CurrentCulture, "Read VerifyExtraction'{0}'", setting);
if (string.IsNullOrEmpty(setting))
{
return false;
}

if (setting.ToLower(CultureInfo.CurrentCulture).Equals("true"))
{
return true;
}

return false;
}
}

public static bool IgnoreExtendedProperties
{
get
{
var setting = Configuration.Builder["appSettings:IgnoreExtendedProperties"];
Logger.Trace(CultureInfo.CurrentCulture, "Read IgnoreExtendedProperties '{0}'", setting);
if (string.IsNullOrEmpty(setting))
{
return false;
}

if (setting.ToLower(CultureInfo.CurrentCulture).Equals("true"))
{
return true;
}

return false;
}
}

public static bool IgnorePermissions
{
get
{
var setting = Configuration.Builder["appSettings:IgnorePermissions"];
Logger.Trace(CultureInfo.CurrentCulture, "Read IgnorePermissions '{0}'", setting);
if (string.IsNullOrEmpty(setting))
{
return false;
}

if (setting.ToLower(CultureInfo.CurrentCulture).Equals("true"))
{
return true;
}

return false;
}
}

public static bool SaveAsBaseline
{
get
{
var setting = Configuration.Builder["appSettings:SaveAsBaseline"];
Logger.Trace(CultureInfo.CurrentCulture, "Read IgnorePermissions '{0}'", setting);
if (string.IsNullOrEmpty(setting))
{
return false;
}

if (setting.ToLower(CultureInfo.CurrentCulture).Equals("true"))
{
return true;
}

return false;
}
}

public static bool UnpackDacpac
{
get
{
var setting = Configuration.Builder["appSettings:UnpackDacpac"];
Logger.Trace(CultureInfo.CurrentCulture, "Read UnpackDacpac '{0}'", setting);
if (string.IsNullOrEmpty(setting))
{
return false;
}

if (setting.ToLower(CultureInfo.CurrentCulture).Equals("true"))
{
return true;
}

return false;
}
}

public static List<string> ColumnTypesToGroupBy
{
get
Expand Down
1 change: 1 addition & 0 deletions DBTestCompareGenerator/DBTestCompareGenerator.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
<PackageReference Include="Microsoft.Extensions.Configuration.FileExtensions" Version="5.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="5.0.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="5.0.1" />
<PackageReference Include="Microsoft.SqlServer.DacFx" Version="162.0.52" />
<PackageReference Include="NLog" Version="4.7.6" />
<PackageReference Include="NLog.Schema" Version="4.7.6" />
<PackageReference Include="NLog.Web.AspNetCore" Version="4.9.3" />
Expand Down
6 changes: 6 additions & 0 deletions DBTestCompareGenerator/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ internal static class Program
{
private static void Main(string[] args)
{
if (Configuration.UnpackDacpac)
{
UnpackDacpac.ExtractDacpacFile();
UnpackDacpac.UnpackDacpacFile();
}

CopyConfigFiles.CopyConfigFile();
var configFromExcel = ReadConfigurationFromXlsx.ReadExcelFile();
CountQuerySqlServer.CreateCountQuery(configFromExcel);
Expand Down
Loading

0 comments on commit cc070b4

Please sign in to comment.