我如何最好的一个的System.Data.DbType枚举值转换为System.Type的价值?
How do I best convert a System.Data.DbType enumeration value to the corresponding (or at least one of the possible corresponding) System.Type values?
例如:
DbType.StringFixedLength -> System.String
DbType.String -> System.String
DbType.Int32 -> System.Int32
我只看到很脏的解决方案,但没有真正干净。
I've only seen very "dirty" solutions but nothing really clean.
(是的,这是一个跟进我的一个不同的问题,但它更有意义的两个独立的问题)
(yes, it's a follow up to a different question of mine, but it made more sense as two seperate questions)
AFAIK没有内置的转换器在.NET中的转换的SqlDbType到一个System.Type的。但我们知道映射到更先进(基于XML的extensability)解决方案,您可以轻松地推出自己的转换,从一个简单的字典。
AFAIK there is no built-in converter in .NET for converting a SqlDbType to a System.Type. But knowing the mapping you can easily roll your own converter ranging from a simple dictionary to more advanced (XML based for extensability) solutions.
的映射可以在这里找到: http://www.carlprothman.net/Default.aspx?tabid=97
The mapping can be found here: http://www.carlprothman.net/Default.aspx?tabid=97