craigmain wrote:
Hi Otis,
Your code interprets null values to a particlar null representation, for example
A null gui is System.Guid.Empty. My database field does not allow null values (the entity should not be able to commit to the database with empty values)
When I add new entities to the collection it does not enforce the not null values at any point until the entity collection is submitted for update.
I need to know how to ascertain whether an entity field is allowed to be null (on the client side) (System.Guid.Empty / string.Empty etc), and where I can enforce this in the entity collection. Perhaps in the validator?
In 1.0.2004.2 I've added this to adapter and selfservicing (in previous versions, it was only available in selfservicing): entity.Fields[index].IsNullable
Then, in an IEntityValidator implementation you check whether entity.Fields[index].IsNullable is false AND entity.Fields[index].IsChanged is true. If not, a not-nullable field hasn't received a value and you should throw an ORMEntityValidationException, which will terminate a transaction in progress.
This is enforced on save. I think that's the right place to do so, otherwise the user hasn't had time to add values
Set the IEntityValidator implementation in an entity initialisation include template or in a user code region. See the documentation for tips how to do that (1.0.2004.2) -> Using the generated code - Adding your own code to the generated classes