它是用UINT而不是INT在数据模型类的主键好主意吗? [英] Is it good idea to use uint instead of int as the primary key in data model class?
本文介绍了它是用UINT而不是INT在数据模型类的主键好主意吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我们知道,主键通常是正整数。
它是使用 UINT
而不是好主意的 INT
在数据模型类的主键
示例:
公共类客户
{
公共UINT客户编号{获取;集;}
//他人省略为简单起见。
}
解决方案
相应的SQL数据类型有符号数,所以我用 INT
,以避免任何意外。
棒
We know that the primary keys are usually positive integers.
Is it good idea to use uint
instead of int
as the primary key in data model class?
Example:
public class Customer
{
public uint CustomerId {get;set;}
//others are omitted for the sake of simplicity.
}
解决方案
The corresponding SQL data type is a signed number, so I'd stick with the int
to avoid any surprises.
这篇关于它是用UINT而不是INT在数据模型类的主键好主意吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文