When a default persistent object is constructed, all its attributes have null values. You can give any of its attributes values or leave them null. Some attributes, however, are not nullable. Although a non-nullable attribute can be set to null, it cannot be committed to the database as null. If you try to commit to the database an update or add transaction with an object whose non-nullable attribute is null, an exception will be thrown.
Three methods that handle null settings are generated for each of the object's attributes:
Call is<Attribute>Nullable to see if the specified attribute can be set to null. Note that attributes in the data ID will return false for this method. Attributes mapped to database columns that are specified as non-nullable will also return false. If you call set<Attribute>To Null for an attribute that is non-nullable, an exception is thrown.
Call is<Attribute>Null to check if an object's attribute is currently set to null. Call set<Attribute>ToNull to set the specified attribute to null.
![]()
Support for
Non-Nullable Columns with Default Values
Data Access
Class Library and Generated Code Reference
