views:

37

answers:

2

Currently my application is 32-bit.

This means that all tables running on SQL Server 2008 IDs' are INT that is equal to System.Int32 and everywhere where I parse strings to integers, I use Int32.TryParse().

I called this Implicit int size indication.

If I will want to make my application to be 64-bit I think there will be 2 scenarios:

  • Rename all Int32 to Int64 and INT to BIGINT.

or

  • Rename all Int32 to int NOW and make int size indication be Explicit.

Which is better, how do you think?

+2  A: 

C# and SQL Server both have fixed size of integers on all platforms. int in C# (which is simply an alias for System.Int32 structure) and SQL Server is always 32 bits. Similarly, long in C# (an alias for System.Int64 structure and SQL Server's bigint are always 64 bits regardless of the platform.

In C#, it's more natural to use the language defined alias for types (int instead of Int32, long instead of Int64) except for public method names (ReadInt64 is preferable to ReadLong) as the method might be used in a language without or with different type aliases and it's better to use the .NET Framework name instead of the C# alias.

Mehrdad Afshari
I don't know why but I was thinking that int is an alias for Int32 on x86 and for In64 on x64. Everything fell into place. Thanks!
abatishchev
Also I prefer static method calls from fully qualified names to aliases: Int32.TryParse() than int.TryParse()
abatishchev
A: 

There is no need to change your data types just because you are recompiling for a 64-bit platform

Ray
I mean not running as x64 process but supporting x64 memory size
abatishchev