EF “code first” enables us to use “plain old CLR objects”
(aka POCO) to represent entities within a database. This means that we do
not have to derive our model classes from a base class, nor implement any
interfaces or attributes on them. This enables us to keep our model
classes clean and “persistence ignorant”.
Above we’ve defined two POCO classes - “Product” and
“Category” – that we’ll use to represent the “Products” and “Categories” tables
within our Northwind database. The properties on these two classes map to
columns within the tables. Each instance of a Product or Category class represents
a row within the respective database tables.