views:

80

answers:

2

Hi, I begin my NHibernate mapping. In major cases I use int type but for some entities I need to persist million of objets. Is long type for identity will be the best choice ?

+3  A: 

Int32 (or just int) is fine for "millions." You only need to start thinking about Int64 (long) if you will have billions of rows.

A signed int can support IDs up to 2,147,483,647.

See Int32.MaxValue.

Aaronaught
A: 

Int will work for values up to 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.

Reed Copsey