Entity Framework & Linq to Entities: “Movies” Example Setup

The Entity Data Model Used in the “Movies” Example

Below are diagrams representing the database, entity data, and entity object model used in the Linq to Entities Quick Reference posts. The Quick References are meant to provide numerous examples of performing common CRUD (Create, Read, Modify, and Delete) tasks with Linq to Entities.

Visit: C# Entity Framework & Linq to Entities (Quick Reference)

Database Structure for the "Movies" Example

Database Structure for the "Movies" Example

Directors Database Records

Directors Database Records

Movies Database Records

Movies Database Records

Entity Diagram for the "Movies" Example

Entity Diagram for the "Movies" Example

This Entity Model was created by adding an ADO.NET Entity Data Model item to the solution and specifying that the model should be generated based on the Movies database. The model was then modified slightly using the Entity Designer within Visual Studio 2008. For instance, the FirstLastName property was changed to Name.
Class diagram of the entity data model for the "Movies" example.

Class diagram of the entity data model for the "Movies" example.

This class diagram is a visual representation of the Entity Framework object model for the Movies example and serves as a valuable resource for understanding its structure, properties, and methods. You can create such a class diagram in your Visual Studio 2008 project by adding a new Class Diagram item to the project, and then dragging the file representing your entity model (.edmx extension) from the Solution Explorer onto the Class Diagram’s design surface. Once the diagram has been created, right click on each of the classes and choose the “Show Base Class” option from the context menu. Doing so will include the core entity framework base classes, such as the ObjectContext class, to the diagram giving you a complete view into what’s available to you.

C# Entity Framework & Linq to Entities (Quick Reference)

The Entity Framework & Linq to Entities: CRUD (Create, Read, Update, Delete) Tasks with CSharp

The Entity Framework in conjunction with Linq to Entities seems to be Microsoft’s ORM (Object Relational Mapping) flavor of the moment. The technology is not without its downsides, but given that the company is making moves to deprecate Linq to SQL by merging that product’s feature set into that of Linq to Entities’; it appears to be the horse Microsoft is betting on. If you’re interested in getting behind Microsoft on this one (as if you had a choice), then there are probably some pretty fundamental tasks you’ll want to be able to perform from the outset.

In this series of posts, I’ll break down how to use Linq to Entities to perform common CRUD (Create, Read, Update, and Delete) tasks with an entity data model generated by Visual Studio 2008 and based on the Entity Framework. I wish I could say that the entity data model model is so obvious that a quick glance at a class diagram would be all one would need to figure these things out. If that were the case, however, I would not have felt the need to write this post, and you would not have found your way to it through the Googles.

Quick References

Quick Reference Setup

Entity Framework & Linq to Entities: “Movies” Example Setup contains diagrams representing the database structure, entity data model, and entity object model used in the Linq to Entities Quick References.