/// <summary> /// Execute SDMX Query against the NSI WS to retrieve SDMX-ML Data as a Stream /// </summary> /// <param name="query"> /// The SDMX Query to execute /// </param> /// <param name="operationName"> /// The type of operation, GetCompactData or GetCrossSectionalData /// </param> /// <exception cref="NsiClientException">Failute to execute query</exception> /// <returns> /// The SDMX-ML data as a stream. /// </returns> public void ExecuteQuery(IDataQuery query, SDMXWSFunction operationName, string tempFileName) { if (query == null) { throw new ArgumentNullException("query"); } try { this.SendSdmxQuery(query, operationName, tempFileName); } catch (NsiClientException e) { Logger.Error(Resources.ExceptionExecuteQuery); NsiClientHelper.TryToDelete(tempFileName); Logger.Error(e.Message, e); throw; } catch (DataflowException e) { throw; } catch (Exception e) { Logger.Error(Resources.ExceptionExecuteQuery); NsiClientHelper.TryToDelete(tempFileName); throw new NsiClientException(Resources.ExceptionExecuteQuery, e); } }
/// <summary> /// Close the dataset freeing memory /// </summary> public void CloseSdmxMLDataSet() { if (this._dataSetSDMXML == null) { return; } NsiClientHelper.TryToDelete(this._dataSetSDMXML); this._dataSetSDMXML = null; }
/// <summary> /// Execute SDMX Query against the NSI WS to retrieve SDMX-ML Data as a Stream /// </summary> /// <param name="query"> /// The SDMX Query to execute /// </param> /// <param name="operationName"> /// The type of operation, GetCompactData or GetCrossSectionalData /// </param> /// <param name="tempFileName"> /// The temporary file name /// </param> /// <exception cref="NsiClientException"> /// Failute to execute query /// </exception> public void ExecuteQuery(IDataQuery query, SDMXWSFunction operationName, string tempFileName) { if (query == null) { throw new ArgumentNullException("query"); } try { switch (operationName) { case SDMXWSFunction.GetCompactData: { this.SendSdmxQuery(query, tempFileName); break; } case SDMXWSFunction.GetCrossSectionalData: { this._nsiClientWs.ExecuteQuery(query, operationName, tempFileName); break; } default: { Logger.Error(Resources.ExceptionExecuteQuery); throw new NsiClientException(Resources.ExceptionExecuteQuery); } } } catch (NsiClientException e) { Logger.Error(Resources.ExceptionExecuteQuery); NsiClientHelper.TryToDelete(tempFileName); Logger.Error(e.Message, e); throw; } catch (DataflowException e) { throw; } catch (Exception e) { Logger.Error(Resources.ExceptionExecuteQuery); NsiClientHelper.TryToDelete(tempFileName); throw new NsiClientException(Resources.ExceptionExecuteQuery, e); } }