JimFoye wrote:
Not sure I understand the problem. What we are calling fields are really just properties, right? So we can't really set them to null (i.e., pointer null), whereas we can or should be able to set them to db null (come to think of it, I don't know off the top of my head how to do that).
The properties are strongly typed, i.e. 'int', so you can only set the property to an int, not for example DBNull.Value. To do that, you have to use entity.SetNewFieldValue(index, value). There is no other way unfortunately. I could generate for every field 2 methods: Set<fieldname>ToNull() and Is<fieldname>Null (or a method and a property), the thing is, it adds in a project with 100 tables, and 10 fields per table 2000 methods to the project. Initially I didn't want to do that, as I didn't see a lot of use for them really, as most users will work with values other than null. If a user wants these, they're easily added through an include template so they're added to every entity class.