Notice that some of the properties within the “Product”
class are defined as nullable (this is what Decimal? means – that indicates it
is a nullable type). Nullable columns within a database table should be
represented within the model class as Nullable properties if they are value
types:
You can also optionally omit specifying nullable columns
entirely from a model class if you don’t need to access it. For example,
the Product table within Northwind has a “QuantityPerUnit” column that is a
nullable nvarchar, and a “UnitsOnOrder” column that is a nullable
smallint. I’ve omitted both of these properties from the “Product” class
I defined above. Because they are nullable within the database I can
still retrieve, insert, update and delete Products without problems.