Workspace server param

This commit is contained in:
christianwade 2019-07-25 17:44:21 -07:00
parent c6f9e2ab18
commit 4c86344a8e
8 changed files with 68 additions and 11 deletions

View File

@ -26,6 +26,7 @@ namespace BismNormalizer.CommandLine
string sourcePassword = "";
string targetUsername = "";
string targetPassword = "";
string workspaceServer = "";
StreamWriter writer = null;
Comparison _comparison = null;
@ -68,6 +69,8 @@ namespace BismNormalizer.CommandLine
Console.WriteLine("");
Console.WriteLine(" /TargetPassword:TargetPassword : Target database password.");
Console.WriteLine("");
Console.WriteLine(" /WorkspaceServer:WorkspaceServer : For SMPROJ sources/targets only, use this workspace server instead of integrated workspace for example.");
Console.WriteLine("");
return ERROR_SUCCESS;
}
@ -82,6 +85,7 @@ namespace BismNormalizer.CommandLine
const string sourcePasswordPrefix = "/sourcepassword:";
const string targetUsernamePrefix = "/targetusername:";
const string targetPasswordPrefix = "/targetpassword:";
const string workspaceServerPrefix = "/workspaceserver:";
for (int i = 1; i < args.Length; i++)
{
@ -138,6 +142,10 @@ namespace BismNormalizer.CommandLine
{
targetPassword = args[i].Substring(targetPasswordPrefix.Length, args[i].Length - targetPasswordPrefix.Length);
}
else if (args[i].Length >= workspaceServerPrefix.Length && args[i].Substring(0, workspaceServerPrefix.Length).ToLower() == workspaceServerPrefix)
{
workspaceServer = args[i].Substring(workspaceServerPrefix.Length, args[i].Length - workspaceServerPrefix.Length);
}
else
{
Console.WriteLine($"'{args[i]}' is not a valid argument.");
@ -181,12 +189,24 @@ namespace BismNormalizer.CommandLine
Console.WriteLine($"Target Database: {comparisonInfo.ConnectionInfoTarget.ServerName};{comparisonInfo.ConnectionInfoTarget.DatabaseName}");
}
if (!String.IsNullOrEmpty(workspaceServer))
{
Console.WriteLine($"Workspace Server: {workspaceServer}");
}
Console.WriteLine();
Console.WriteLine("--Comparing ...");
if (credsProvided)
{
if (!String.IsNullOrEmpty(workspaceServer))
{
_comparison = ComparisonFactory.CreateComparison(comparisonInfo, sourceUsername, sourcePassword, targetUsername, targetPassword, workspaceServer);
}
else
{
_comparison = ComparisonFactory.CreateComparison(comparisonInfo, sourceUsername, sourcePassword, targetUsername, targetPassword);
}
}
else
{
_comparison = ComparisonFactory.CreateComparison(comparisonInfo);

View File

@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("4.0.1.8")]
[assembly: AssemblyFileVersion("4.0.1.8")]
[assembly: AssemblyVersion("4.0.1.10")]
[assembly: AssemblyFileVersion("4.0.1.10")]

View File

@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("4.0.1.8")]
[assembly: AssemblyFileVersion("4.0.1.8")]
[assembly: AssemblyVersion("4.0.1.10")]
[assembly: AssemblyFileVersion("4.0.1.10")]

View File

@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("4.0.1.8")]
[assembly: AssemblyFileVersion("4.0.1.8")]
[assembly: AssemblyVersion("4.0.1.10")]
[assembly: AssemblyFileVersion("4.0.1.10")]

View File

@ -70,6 +70,17 @@ namespace BismNormalizer.TabularCompare
return CreateComparisonInitialized(comparisonInfo);
}
/// <summary>
/// Uses factory design pattern to return an object of type Core.Comparison, which is instantiated using MultidimensionalMetadata.Comparison or TabularMeatadata.Comparison depending on SSAS compatibility level.
/// </summary>
/// <param name="comparisonInfo">ComparisonInfo object for the comparison.</param>
/// <returns>Core.Comparison object</returns>
public static Comparison CreateComparison(ComparisonInfo comparisonInfo, string sourceUsername, string sourcePassword, string targetUsername, string targetPassword, string workspaceServer)
{
comparisonInfo.InitializeCompatibilityLevels(sourceUsername, sourcePassword, targetUsername, targetPassword, workspaceServer);
return CreateComparisonInitialized(comparisonInfo);
}
private static Comparison CreateComparisonInitialized(ComparisonInfo comparisonInfo)
{
Telemetry.TrackEvent("CreateComparisonInitialized", new Dictionary<string, string> { { "App", "BismNormalizer" } });

View File

@ -153,6 +153,26 @@ namespace BismNormalizer.TabularCompare
PopulateDatabaseProperties();
}
/// <summary>
/// Finds models' compatibility levels (and preps databases on workspace servers for comparison). This overload to be used when client is not Visual Studio - e.g. command line.
/// </summary>
public void InitializeCompatibilityLevels(string sourceUsername, string sourcePassword, string targetUsername, string targetPassword, string workspaceServer)
{
ConnectionInfoSource.CredsProvided = true;
ConnectionInfoSource.Username = sourceUsername;
ConnectionInfoSource.Password = sourcePassword;
ConnectionInfoSource.InitializeCompatibilityLevel(workspaceServer: workspaceServer);
ConnectionInfoTarget.CredsProvided = true;
ConnectionInfoTarget.Username = targetUsername;
ConnectionInfoTarget.Password = targetPassword;
ConnectionInfoTarget.InitializeCompatibilityLevel(workspaceServer: workspaceServer);
PopulateDatabaseProperties();
}
/// <summary>
/// Finds model compatibility levels (and preps databases on workspace servers for comparison). This overload to be used when running in Visual Studio. Allows user to cancel if doesn't want to close .bim file(s).
/// </summary>

View File

@ -336,7 +336,7 @@ namespace BismNormalizer.TabularCompare
/// This method ensures the tabular model is online and populates the CompatibilityLevel property.
/// </summary>
/// <param name="closedBimFile">A Boolean specifying if the user cancelled the comparison. For the case where running in Visual Studio, the user has the option of cancelling if the project BIM file is open.</param>
public void InitializeCompatibilityLevel(bool closedBimFile = false)
public void InitializeCompatibilityLevel(bool closedBimFile = false, string workspaceServer = null)
{
if (UseProject)
{
@ -358,6 +358,12 @@ namespace BismNormalizer.TabularCompare
//Read project file to get deployment server/cube names, and bim file
ReadProjectFile();
//Overwrite the server if a workspace server provided
if (!String.IsNullOrEmpty(workspaceServer))
{
this.ServerName = workspaceServer;
}
}
Server amoServer = new Server();

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<PackageManifest Version="2.0.0" xmlns="http://schemas.microsoft.com/developer/vsx-schema/2011" xmlns:d="http://schemas.microsoft.com/developer/vsx-schema-design/2011">
<Metadata>
<Identity Id="BismNormalizer.ea2aeb43-64a6-4dee-8816-099fb44513fa" Version="4.0.1.8" Language="en-US" Publisher="BISM Normalizer" />
<Identity Id="BismNormalizer.ea2aeb43-64a6-4dee-8816-099fb44513fa" Version="4.0.1.10" Language="en-US" Publisher="BISM Normalizer" />
<DisplayName>BISM Normalizer</DisplayName>
<Description xml:space="preserve">BISM Normalizer manages Analysis Services tabular models</Description>
<MoreInfo>http://bism-normalizer.com/</MoreInfo>