Esempio n. 1
0
        /// <summary>
        /// Create time dimension mapping without transcoding
        /// </summary>
        /// <param name="mapping">
        /// The mapping entity<see cref="MappingEntity"/> of the Time Dimension component
        /// </param>
        /// <param name="databaseType">
        /// The dissemination database vendor. Is needed to generate the correct SQL query where conditions
        /// </param>
        /// <exception cref="TranscodingException">
        /// Incomplete Mapping. N column Time Dimension mapping without transcoding is not supported, where N not in 0,1
        /// </exception>
        /// <returns>
        /// An Time Dimension Transcoding object<see cref="ITimeDimension"/>
        /// </returns>
        private static ITimeDimensionMapping CreateTimeDimensionMapping(MappingEntity mapping, string databaseType)
        {
            ITimeDimensionMapping timeDimensionTranscoding;

            switch (mapping.Columns.Count)
            {
            case 1:
                timeDimensionTranscoding = new TimeDimension1To1(mapping, null, databaseType);
                break;

            case 0:
                timeDimensionTranscoding = new TimeDimensionConstant(mapping, null, databaseType);
                break;

            default:
                throw new TranscodingException(
                          string.Format(
                              CultureInfo.CurrentCulture,
                              ErrorMessages.TimeDimensionUnsupportedMappingFormat1,
                              mapping.Columns.Count)); // MAT-496
            }

            return(timeDimensionTranscoding);
        }
        /// <summary>
        /// Create time dimension mapping without transcoding
        /// </summary>
        /// <param name="mapping">
        /// The mapping entity<see cref="MappingEntity"/> of the Time Dimension component
        /// </param>
        /// <param name="databaseType">
        /// The dissemination database vendor. Is needed to generate the correct SQL query where conditions
        /// </param>
        /// <exception cref="TranscodingException">
        /// Incomplete Mapping. N column Time Dimension mapping without transcoding is not supported, where N not in 0,1
        /// </exception>
        /// <returns>
        /// An Time Dimension Transcoding object<see cref="ITimeDimension"/>
        /// </returns>
        private static ITimeDimensionMapping CreateTimeDimensionMapping(MappingEntity mapping, string databaseType)
        {
            ITimeDimensionMapping timeDimensionTranscoding;
            switch (mapping.Columns.Count)
            {
                case 1:
                    timeDimensionTranscoding = new TimeDimension1To1(mapping, null, databaseType);
                    break;
                case 0:
                    timeDimensionTranscoding = new TimeDimensionConstant(mapping, null, databaseType);
                    break;
                default:
                    throw new TranscodingException(
                        string.Format(
                            CultureInfo.CurrentCulture, 
                            ErrorMessages.TimeDimensionUnsupportedMappingFormat1, 
                            mapping.Columns.Count)); // MAT-496
            }

            return timeDimensionTranscoding;
        }