/// <summary>
        /// Getter for the special data count request
        /// </summary>
        /// <returns>
        /// A codelist with one code, the number of data
        /// </returns>
        private CodeListBean GetCountCodelist()
        {
            var codelist = new CodeListBean();
            var name = new TextTypeBean(CustomCodelistConstants.CountCodeListName, CustomCodelistConstants.Lang);
            codelist.Names.Add(name);
            codelist.Id = CustomCodelistConstants.CountCodeList;
            codelist.AgencyId = CustomCodelistConstants.Agency;
            codelist.Version = CustomCodelistConstants.Version;
            this._logger.LogInformation("|-- Generating SQL WHERE for dissemination database...");
            string sqlWhere = this.GenerateWhere(this._criteria);
            this._logger.LogInformation("|-- Generating SQL for dissemination database...");
            string sql = this.GenerateCountSql(sqlWhere);
            this._logger.LogInformation("|-- SQL for dissemination database generated:\n" + sql);
            int xsMeasureMult = 1;
            if (this._measureComponent != null)
            {
                this._logger.LogInformation("|-- Get XS Measure count");
                xsMeasureMult = this.GetXsMeasureCount(this._criteria);
            }

            object value = this.ExecuteSql(sql);

            // setup count codelist
            var countCode = new CodeBean();
            var text = new TextTypeBean(CustomCodelistConstants.CountCodeDescription, CustomCodelistConstants.Lang);
            countCode.Descriptions.Add(text);

            // normally count(*) should always return a number. Checking just in case I missed something.
            if (value != null && !Convert.IsDBNull(value))
            {
                long count = Convert.ToInt64(value, CultureInfo.InvariantCulture);

                // in .net, oracle will return 128bit decimal, sql server 32bit int, while mysql & sqlite 64bit long.
                // check if there are XS measure mappings. In this case there could be multiple measures/obs per row. 
                // even if they are not, then will be static mappings
                count *= xsMeasureMult;

                countCode.Id = count.ToString(CultureInfo.InvariantCulture);
                codelist.AddItem(countCode);
            }
            else
            {
                countCode.Id = CustomCodelistConstants.CountCodeDefault;
            }

            return codelist;
        }
        /// <summary>
        /// Setup a CodelistBean object as a TimeDimension codelist containing two codes, startTime and endTime and using as codelist id the <see cref="CustomCodelistConstants.TimePeriodCodeList"/>.
        /// </summary>
        /// <param name="startTime">
        /// The code that will contain the start Time period
        /// </param>
        /// <param name="endTime">
        /// The code that will contain the end Time period
        /// </param>
        /// <param name="timeCodeList">
        /// The codelist to setup
        /// </param>
        private static void SetupTimeCodelist(CodeBean startTime, CodeBean endTime, CodeListBean timeCodeList)
        {
            timeCodeList.Id = CustomCodelistConstants.TimePeriodCodeList;
            timeCodeList.AgencyId = CustomCodelistConstants.Agency;
            timeCodeList.Version = CustomCodelistConstants.Version;
            timeCodeList.Names.Add(
                new TextTypeBean(CustomCodelistConstants.TimePeriodCodeListName, CustomCodelistConstants.Lang));
            startTime.Descriptions.Add(new TextTypeBean(CustomCodelistConstants.TimePeriodStartDescription, CustomCodelistConstants.Lang));
            timeCodeList.AddItem(startTime);

            if (endTime != null)
            {
                endTime.Descriptions.Add(new TextTypeBean(CustomCodelistConstants.TimePeriodEndDescription, CustomCodelistConstants.Lang));

                timeCodeList.AddItem(endTime);
            }
        }