public PartitionMetadata(string partitionName, AdomdClient.Tuple t)
 {
     this.PartitionName = partitionName;
     this.tuples.Add(t);
 }
 private static string GetTupleName(AdomdClient.Tuple t)
 {
     StringBuilder sName = new StringBuilder();
     foreach (AdomdClient.Member m in t.Members)
     {
         sName.Append((sName.Length == 0 ? "" : " - ")).Append(m.Caption);
     }
     foreach (char c in invalidChars)
     {
         sName.Replace(c,' ');
     }
     return sName.ToString();
 }
 private static string GetTupleUniqueName(AdomdClient.Tuple t)
 {
     string sUniqueName = "";
     foreach (AdomdClient.Member m in t.Members)
     {
         if (m.UniqueName.ToUpper().EndsWith(".UNKNOWNMEMBER"))
         {
             sUniqueName += (sUniqueName.Length == 0 ? "" : ", ") + m.UniqueName.Substring(0, m.UniqueName.Length - "UNKNOWNMEMBER".Length) + "[" + m.Caption + "]";
         }
         else
         {
             sUniqueName += (sUniqueName.Length == 0 ? "" : ", ") + m.UniqueName;
         }
     }
     return "(" + sUniqueName + ")";
 }
 //as a workaround to a bug: https://connect.microsoft.com/feedback/viewfeedback.aspx?FeedbackID=260636&siteid=68&wa=wsignin1.0
 private static object[] GetMemberKeys(AdomdClient.Member m, int iNumKeys)
 {
     AdomdClient.AdomdConnection conn = new AdomdClient.AdomdConnection("Data Source=" + AdomdServer.Context.CurrentServerID + ";Initial Catalog=" + AdomdServer.Context.CurrentDatabaseName);
     conn.ShowHiddenObjects = true; //ShowHiddenObjects=true allows you to see properties (like member.ParentLevel) of dimension attributes which aren't visible: https://connect.microsoft.com/SQLServer/feedback/ViewFeedback.aspx?FeedbackID=265114
     conn.Open();
     try
     {
         StringBuilder sCmd = new StringBuilder();
         sCmd.AppendLine("with");
         for (int i = 0; i < iNumKeys; i++)
         {
             sCmd.AppendLine("member [Measures].[_ASSP_MemberKey" + i + "] as " + m.ParentLevel.ParentHierarchy.UniqueName + ".CurrentMember.Properties('Key" + i + "')");
         }
         sCmd.Append("select {");
         for (int i = 0; i < iNumKeys; i++)
         {
             if (i > 0) sCmd.Append(", ");
             sCmd.Append("[Measures].[_ASSP_MemberKey" + i + "]");
         }
         sCmd.AppendLine("} on 0,");
         sCmd.Append(m.UniqueName).AppendLine(" on 1");
         sCmd.Append("from [").Append(m.ParentLevel.ParentHierarchy.ParentDimension.ParentCube.Name).AppendLine("]");
         AdomdClient.AdomdCommand cmd = new AdomdClient.AdomdCommand();
         cmd.Connection = conn;
         cmd.CommandText = sCmd.ToString();
         AdomdClient.CellSet cs = cmd.ExecuteCellSet();
         List<object> keys = new List<object>(cs.Cells.Count);
         foreach (AdomdClient.Cell c in cs.Cells)
         {
             keys.Add(c.CellProperties["FORMATTED_VALUE"].Value); //the FORMATTED_VALUE will be null if it should be null
         }
         return keys.ToArray();
     }
     finally
     {
         try
         {
             conn.Close();
         }
         catch { }
     }
 }