private int GetDimensionId(string tableName, string value, QueryCache cache)
        {
            var ret = cache.GetId(tableName, value);

            if (ret < 1)
            {
                ret = GetDimensionId(tableName, value);
                cache.Add(tableName, value, ret);
            }
            return(ret);
        }
        public void FillFactTable(string prefix, string datasetName, List <Dimension> dimensions, List <Measure> measures, DataTable values)
        {
            var queryCache = new QueryCache();
            var allRows    = new List <List <Column> >();

            foreach (DataRow row in values.Rows)
            {
                var measureColumns = measures.Select(measure => new Column
                {
                    Name  = measure.Name,
                    Value = row[measure.Name].ToString()
                }).ToList();
                // We insert fks only for root dimensions
                var dimensionColumns = dimensions.Where(d => d.ParentDimension == null).Select(dimension => new Column
                {
                    Name  = dimension.Name + Constants.String.Id,
                    Value = GetDimensionId(prefix + datasetName + dimension.Name, row[dimension.Name].ToString(dimension.Type.ToType()), queryCache).ToString()
                }).ToList();
                allRows.Add(dimensionColumns.Concat(measureColumns).ToList());
            }
            QueryBuilder.Insert(prefix + datasetName + Constants.String.FactTable, allRows);
        }