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 sourcePassword = "";
string targetUsername = ""; string targetUsername = "";
string targetPassword = ""; string targetPassword = "";
string workspaceServer = "";
StreamWriter writer = null; StreamWriter writer = null;
Comparison _comparison = null; Comparison _comparison = null;
@ -68,6 +69,8 @@ namespace BismNormalizer.CommandLine
Console.WriteLine(""); Console.WriteLine("");
Console.WriteLine(" /TargetPassword:TargetPassword : Target database password."); Console.WriteLine(" /TargetPassword:TargetPassword : Target database password.");
Console.WriteLine(""); 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; return ERROR_SUCCESS;
} }
@ -82,6 +85,7 @@ namespace BismNormalizer.CommandLine
const string sourcePasswordPrefix = "/sourcepassword:"; const string sourcePasswordPrefix = "/sourcepassword:";
const string targetUsernamePrefix = "/targetusername:"; const string targetUsernamePrefix = "/targetusername:";
const string targetPasswordPrefix = "/targetpassword:"; const string targetPasswordPrefix = "/targetpassword:";
const string workspaceServerPrefix = "/workspaceserver:";
for (int i = 1; i < args.Length; i++) 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); 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 else
{ {
Console.WriteLine($"'{args[i]}' is not a valid argument."); Console.WriteLine($"'{args[i]}' is not a valid argument.");
@ -181,11 +189,23 @@ namespace BismNormalizer.CommandLine
Console.WriteLine($"Target Database: {comparisonInfo.ConnectionInfoTarget.ServerName};{comparisonInfo.ConnectionInfoTarget.DatabaseName}"); Console.WriteLine($"Target Database: {comparisonInfo.ConnectionInfoTarget.ServerName};{comparisonInfo.ConnectionInfoTarget.DatabaseName}");
} }
if (!String.IsNullOrEmpty(workspaceServer))
{
Console.WriteLine($"Workspace Server: {workspaceServer}");
}
Console.WriteLine(); Console.WriteLine();
Console.WriteLine("--Comparing ..."); Console.WriteLine("--Comparing ...");
if (credsProvided) if (credsProvided)
{ {
_comparison = ComparisonFactory.CreateComparison(comparisonInfo, sourceUsername, sourcePassword, targetUsername, targetPassword); if (!String.IsNullOrEmpty(workspaceServer))
{
_comparison = ComparisonFactory.CreateComparison(comparisonInfo, sourceUsername, sourcePassword, targetUsername, targetPassword, workspaceServer);
}
else
{
_comparison = ComparisonFactory.CreateComparison(comparisonInfo, sourceUsername, sourcePassword, targetUsername, targetPassword);
}
} }
else else
{ {
@ -279,7 +299,7 @@ namespace BismNormalizer.CommandLine
{ {
foreach (ComparisonObject comparisonObj in comparisonObjects) foreach (ComparisonObject comparisonObj in comparisonObjects)
{ {
if ( ((skipOption == ComparisonObjectStatus.MissingInSource.ToString() && comparisonObj.Status == ComparisonObjectStatus.MissingInSource) || if (((skipOption == ComparisonObjectStatus.MissingInSource.ToString() && comparisonObj.Status == ComparisonObjectStatus.MissingInSource) ||
(skipOption == ComparisonObjectStatus.MissingInTarget.ToString() && comparisonObj.Status == ComparisonObjectStatus.MissingInTarget) || (skipOption == ComparisonObjectStatus.MissingInTarget.ToString() && comparisonObj.Status == ComparisonObjectStatus.MissingInTarget) ||
(skipOption == ComparisonObjectStatus.DifferentDefinitions.ToString() && comparisonObj.Status == ComparisonObjectStatus.DifferentDefinitions) (skipOption == ComparisonObjectStatus.DifferentDefinitions.ToString() && comparisonObj.Status == ComparisonObjectStatus.DifferentDefinitions)
) && comparisonObj.MergeAction != MergeAction.Skip ) && comparisonObj.MergeAction != MergeAction.Skip

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 // You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below: // by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("4.0.1.8")] [assembly: AssemblyVersion("4.0.1.10")]
[assembly: AssemblyFileVersion("4.0.1.8")] [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 // You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below: // by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("4.0.1.8")] [assembly: AssemblyVersion("4.0.1.10")]
[assembly: AssemblyFileVersion("4.0.1.8")] [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 // You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below: // by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("4.0.1.8")] [assembly: AssemblyVersion("4.0.1.10")]
[assembly: AssemblyFileVersion("4.0.1.8")] [assembly: AssemblyFileVersion("4.0.1.10")]

View File

@ -70,6 +70,17 @@ namespace BismNormalizer.TabularCompare
return CreateComparisonInitialized(comparisonInfo); 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) private static Comparison CreateComparisonInitialized(ComparisonInfo comparisonInfo)
{ {
Telemetry.TrackEvent("CreateComparisonInitialized", new Dictionary<string, string> { { "App", "BismNormalizer" } }); Telemetry.TrackEvent("CreateComparisonInitialized", new Dictionary<string, string> { { "App", "BismNormalizer" } });

View File

@ -153,6 +153,26 @@ namespace BismNormalizer.TabularCompare
PopulateDatabaseProperties(); 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> /// <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). /// 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> /// </summary>

View File

@ -336,7 +336,7 @@ namespace BismNormalizer.TabularCompare
/// This method ensures the tabular model is online and populates the CompatibilityLevel property. /// This method ensures the tabular model is online and populates the CompatibilityLevel property.
/// </summary> /// </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> /// <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) if (UseProject)
{ {
@ -358,6 +358,12 @@ namespace BismNormalizer.TabularCompare
//Read project file to get deployment server/cube names, and bim file //Read project file to get deployment server/cube names, and bim file
ReadProjectFile(); ReadProjectFile();
//Overwrite the server if a workspace server provided
if (!String.IsNullOrEmpty(workspaceServer))
{
this.ServerName = workspaceServer;
}
} }
Server amoServer = new Server(); Server amoServer = new Server();

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?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"> <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> <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> <DisplayName>BISM Normalizer</DisplayName>
<Description xml:space="preserve">BISM Normalizer manages Analysis Services tabular models</Description> <Description xml:space="preserve">BISM Normalizer manages Analysis Services tabular models</Description>
<MoreInfo>http://bism-normalizer.com/</MoreInfo> <MoreInfo>http://bism-normalizer.com/</MoreInfo>