[英]NHibernate identity : int or long
I begin my NHibernate mapping. 我开始进行NHibernate映射。 In major cases I use int type but for some entities I need to persist million of objets. 在大多数情况下,我使用int类型,但对于某些实体,我需要保留数百万个对象。 Is long type for identity will be the best choice ? 长身份识别将是最佳选择吗?
Int32
(or just int
) is fine for "millions." Int32
(或仅仅是int
)对于“百万”来说很好。 You only need to start thinking about Int64
( long
) if you will have billions of rows. 如果您将拥有数十亿行,则只需开始考虑Int64
( long
)。
A signed int
can support IDs up to 2,147,483,647. 一个有符号的int
最多可以支持2,147,483,647个ID。
See Int32.MaxValue . 请参见Int32.MaxValue 。
Int will work for values up to 2,147,483,647. Int的最大值为2,147,483,647。 That should be fine for "millions of objects." 对于“数百万个对象”来说应该没问题。
For data ranges, see the Integral Types Table . 有关数据范围,请参阅“ 积分类型表” 。 If you really need more, you could use uint. 如果您确实需要更多,可以使用uint。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.