Ejemplo n.º 1
0
        public string ToLanguageType(DbProviderType dbProviderType, LanguageType targetLanguage, string dbColumnType)
        {
            Check.NotNullOrEmpty(dbColumnType, nameof(dbColumnType));

            var providerMapping = _mappingsLoader.Get(dbProviderType);

            if (null == providerMapping)
            {
                throw new DbProviderMappingUndefinedException(dbProviderType);
            }

            var columnMapping = providerMapping.Columns
                                .FirstOrDefault(e => e.Source == dbColumnType);

            if (null == columnMapping)
            {
                throw new DbColumnTypeMappingUndefinedException(dbColumnType);
            }

            var languageTypeMapping = columnMapping.Targets
                                      .FirstOrDefault(e => e.Language == targetLanguage.ToString());

            if (null == languageTypeMapping)
            {
                throw new ColumnTypeLanguageMappingUndefinedException(targetLanguage, dbColumnType);
            }

            return(languageTypeMapping.TypeName);
        }
Ejemplo n.º 2
0
        public void Can_Get_SqlServer_Mapping()
        {
            var result = _mappingsLoader.Get(DbProviderType.SqlServer);

            result.ShouldNotBeNull();
        }