Lets say that I have an entity with a string field and an int32 field. The int32 field contains the FK of a related table. Both are required fields.
Testing the validity of the string field is easy: entity.StringField.ToString().Trim() would trigger a validation error.
Testing the int32 field is not so easy: The DBValue is null (because it's a new entity) but you can't test for DBValue because entering a value into entity.IntField doesn't change entity.IntField.DBValue - - it's STILL null. Therefore, testing for null (by using DBValue or TestOriginalFieldValueForNull) doesn't help in this validation scenario because you'd get an inaccurate TRUE value if you'd made an entry into the entity.IntField. We could test for TypeDefaultValue.GetDefaultValue - - but that doesn't work either, because the default valueToReturn for System.Int32 is 0, which MIGHT be considered a valid entry.
So, I can't seem to figure this problem out.
Does anyone have some ideas on this?
Thanks. Jeff