开发者

Programmatically mapping .NET types onto SQL Server types?

开发者 https://www.devze.com 2023-02-16 02:23 出处:网络
Is there any way to programmatically map a .NET type (such a开发者_如何学Pythons typeof(int)) into its corresponding SqlDbType (such as SqlDbType.Int)?Have you looked into The Entity Framework?This wi

Is there any way to programmatically map a .NET type (such a开发者_如何学Pythons typeof(int)) into its corresponding SqlDbType (such as SqlDbType.Int)?


Have you looked into The Entity Framework? This will do all of the mappings for you.


Not that I know of, tehre is no exposure of whatever method is used internally. Your best bet it your own extension method / mapping repository that uses a switch statement or a hashtable.


See Also:

SQL Server Data Type Mappings (ADO.NET)

0

精彩评论

暂无评论...
验证码 换一张
取 消