Database Primary Key C# mapping - String or int

前端 未结 3 593
悲&欢浪女
悲&欢浪女 2021-01-15 05:25

In the Northwind Starters Kit, Primary keys from database are mapped to Strings in C#.

Is this good practice? And if so, why?

thx, Lieven Cardoen

ps:

3条回答
  •  情书的邮戳
    2021-01-15 05:53

    Always use the corresponding C# datatype for the Sql datatype. As other posters have noted, to do anything else is asking for problems later on.

    Have a look at this article: http://msdn.microsoft.com/en-us/library/ms131092.aspx for a full list of Sql Server / C# data type equivalents.

提交回复
热议问题