For example, I have an Int32 primary key called "CustomerID" and I set the value in SetDefaultValues() and the value is unique. I call BO.Add() which sets the value of CustomerID. I check the value of BO.CustomerID and it is correctly set to a valid value. However, when I do BO.Save() the CustomerID field is not written back to the SQL database (I can see this in SQL Profiler).
I have tried setting PrimaryKeyIsUpdatable to true but I guess I haven't done it correctly as Save() never writes the primary key.
Can anyone help?
Thanks in advance.
Hi Paul,
Thanks for the code must appreciated. Of course I did not have it since I am currently not using GUID for the current project, but yes, I will use it.
By taking this type of logic into account, we turned a query taking 4.5 seconds the other day on a very large database into 22 ms....that was a happy day We made an even larger impact when dealing with dates. Instead of storing these fields that we will be testing on with >= or <= as a date, we stored them as ticks in a BigInt field. This was the largest change in performance that we had seen thus far. Databases deal with integer data better than strings when it comes to performance and parameters. You won't have as large a hit on a PK field, but you don't want to box yourself into a corner either.