I know this is out of sequence for this blog, but I really needed to get a better grasp on what the Entity Framework is, so I did some research on it, and rather than waste good knowledge, I figured I’d write about it now and we can come back to it later.  At its simplest form, the Entity Framework is kind of a translator between the “object model” of the database (tables grouped by task and likeness of the data) and the application that is using the data from the database (which typically uses OOP structure, so you have methods, properties and events).  So, think of it as a way of using a programming model structure to converse, in programming-type language, with a set of database tables.  This is an overly simple way of looking at it, of course, but then again, that’s my goal with this blog!

The first thing we need to look at is an Entity then, and understand what it means in this context, as this is the fundamental unit of the Entity Framework.  An Entity is actually an instantiation of an Entity Type, much like an object is an instantiation of a class.  Basically, an Entity Type maps to a database table and what it contains, for instance a Person table, so the Entity would be the Object instantiated from this Table.

The other concept to grasp is that of the Relationship – again, a Relationship is an instantiation of a Relationship Type.  A Relationship Type is an association between Entities.  As an example, when you have the above-mentioned Person Table, but you also need data from another table, such as Employment to confirm if someone is indeed employed, you create a Relationship between the Tables.

To put this in “pictures”, if you open the Query Designer, the boxes would be the Entities and the Relationships would be the lines between them when you draw a query out.  Again, this is overly simplistic, but it should help you to get your head around the Entity Framework.  If you want a much more detailed dissertation, I suggest looking at Julie Lerman’s Webpage (she has written two books on the subject) at http://thedatafarm.com/main.aspx.  Another good resource I have found is Frans Bouma’s blog, specifically the post here.