diff --git a/MdxClient/MdxCommand.cs b/MdxClient/MdxCommand.cs index 7a9cc36..d71d852 100644 --- a/MdxClient/MdxCommand.cs +++ b/MdxClient/MdxCommand.cs @@ -27,6 +27,7 @@ public class MdxCommand : DbCommand private readonly XNamespace _namespace = "urn:schemas-microsoft-com:xml-analysis:mddataset"; private readonly XNamespace _xsiNs = "http://www.w3.org/2001/XMLSchema-instance"; private IEnumerable _columnMap; + private static readonly string[] invalid = new[] { "NAN", "INF", "-INF" }; #endregion #region constructors @@ -613,8 +614,12 @@ private void AddRows(IEnumerable rows, List cells, int rowColumnCou // this is done because the xml coming back does not include nulls/empty data. We have to fill in the gap or the subsequent objects will throw the data off if (Convert.ToInt32(cell.Ordinal) == i) { - cellToAdd = cell; - AdjustValueFromColumnType(cellToAdd, cell.Ordinal % (columnCountFromColumnAxis) + rowColumnCount, crs); + // Do this only if it's not infinity or NaN + if (!(cell.Type != "xsd:string" && cell.Value != null && invalid.Contains(cell.Value.ToString()))) + { + cellToAdd = cell; + AdjustValueFromColumnType(cellToAdd, cell.Ordinal % (columnCountFromColumnAxis) + rowColumnCount, crs); + } cellsIndexer++; } } diff --git a/MdxClient/MdxConnection.cs b/MdxClient/MdxConnection.cs index be2db36..ad6f21b 100644 --- a/MdxClient/MdxConnection.cs +++ b/MdxClient/MdxConnection.cs @@ -41,6 +41,12 @@ internal AdomdConnection Connection } } + public String SessionID + { + get { return _connection.SessionID; } + set { _connection.SessionID = value; } + } + protected override DbTransaction BeginDbTransaction(IsolationLevel isolationLevel) { if (IsolationLevel.Unspecified == isolationLevel || IsolationLevel.ReadCommitted == isolationLevel) @@ -67,6 +73,15 @@ public override void Close() _connection.Close(); } + /// + /// Closes the connection to the database, while giving an option to leave the session open. + /// + /// If false, the session will remain open so it can be reused + public void Close(bool endSession) + { + _connection.Close(endSession); + } + /// /// Gets or sets the string used to open a SQL Server Analysis Services database. ///