Asimov wrote:
But let's say I read an entity from the database and I put it into the session. A user can modify it in the session before resaving it to the database. One of the fields in the entity is nullable. Therefore, when the user saves the entity in the session, if the texbox corresponding to the nullable field (which is a date) is empty, what should I do to mark it as being null in memory? Should I manually access IsNull and then check back on IsNull to know whether it is null in memory?
Thanks
You can't mark it as null in memory, at least not with some sort of flag. This is because NULL doesn't exist in the world of entities in memory, as you can't work with NULL in .NET, at least not with valuetypes, they always have a value.
To make a field NULL in the database, use the code you use now, SetNewFieldValue(). To test if a field is null/Nothing, use myEntity.Fields[index].CurrentValue==null