We use a base entity with properties such as version (datetime needed for NHibernate) and guid (as key).
It also has an Id (int) field with two functions. Firstly to relate to legacy application key if there is one. Secondly as a shorthand code: for instance files are sometimes created based on these which would look ugly and long using our guid key. My question is not really about pros and cons of base entities but about up-typing this Id to Int64?
It would not affect how it is stored within our MS SQL Server database. Would it have more cost in our cache and memory?. Is this really that much of a worry?
I am interested to hear other downsides besides performance. Consider also these values will probably be exposed through web services to third parties in time too.
The alternative is to deal with the exceptions of larger integers as they arise and implement them specifically in derived entities. The downside is this would need to be done in code and what would we do when we discover some cases when in production of larger integers? There would of course be input validation to stop actual errors but it may restrict expanding data.
Well, int64 uses 8 byte of memory storage, while int uses 4 byte… however, you pointed out most of the disadvantages already. Of course calculations performed will also be slower on many systems (a 64 bit system running in 64 bit mode can perform operations on 64 bit as fast as on 32 bit, but a 32 bit system needs to perform extra work, that means adding two 64 bit numbers is performed by two 32 bit adds plus some extra code – other math operations will be equally broken down into 32 bit operations). However unless you store millions of these numbers and perform tons of operations with them, I doubt you will see any performance difference, though, neither in CPU time nor in memory.