Default Values for Primary Keys and Foreign Keys

In your database, you may have a Default Value defined for your primary keys and foreign keys.  When Iron Speed Designer finds default values it assumes that you may have a function defined that could create a new Id value.  This is typically the case with GUID's where the DefaultValue is specified as newid().  Because of this, Iron Speed Designer does not actually try to save the value of the field if and only if the field has a Default Value AND if the field is a Primary Key or a Foreign Key.

The assumption is that if Default Values exist on a Primary Key, then it is typically used similar to the newid() for GUID's.  The same is true for Foreign Keys you have a NON-NULL constraint and a Default Value for the Foreign Key.  Again the assumption is that if you specified a Non-Null constraint and a Default Value, then Iron Speed Designer assumes that you are trying to calculate the value instead of specifying it.

The end result is that any value entered for the field in the application is not actually saved in the database.  While this might be viewed as a bug, there are several situations where saving the value would be considered a bug.

Consequently, a Primary Key cannot have a static Default Value and also be Unique.  Similarly, a Foreign Key cannot be both NOT-NULL and have a Default Value of (0).

See Also

Transaction Management