Skip to content
SQL Server Blog

It’s getting louder

If you’ve been following Microsoft’s efforts around data programmability, you’ll have inevitably heard a thing or two about “entities”. Specifically, the Entity Data Model (EDM) and the ADO.NET Entity Framework (EF). These technologies lay the groundwork for major advancements in how developers build data-centric applications and for empowering DBA’s to manage databases more freely. One could argue, the EDM and EF are triggering a paradigm shift in database development.

What’s the problem?

Traditionally, database developers have had to bridge two worlds: application development and database management. These are relatively easy worlds to manage when building small or single user applications, however, things quickly become complicated as data grows and as more applications need access to the same information. In such complex environments, changes to the underlying databases may need to be synchronized across multiple applications that access this information and across several teams that are responsible for maintaining those applications. DBA’s and developers have to proceed in lock-step to properly reflect changes/improvements to both applications and databases.

Entities to the rescue

The Entity Data Model and ADO.NET Entity Framework were designed to address this application/database divide and, along the way, improve how database applications are designed and developed. Entities are essentially a conceptual representation of information (e.g. Customer entity) that is mapped to underlying databases objects (e.g. CustomersMaster, CustomerDetail, CustomerOrders, CustomerHistory tables). This allows developers to efficiently program using easy-to-understand entities that map directly to real-world business concepts (e.g. Customer) without concern for how the entity information is actually stored in a database (e.g. the multiple tables and relationships that store the customer data). Additionally, the EDM and EF enables DBA’s to continually optimize the data storage without disrupting applications that access this information since applications built using entities are shielded from underlying database changes. Any updates to the database schema can be easily reflected in the entity mapping that binds applications to the databases.

“Data Abstraction”, I get it but …

At this point, people usually understand that entities efficiently abstract data access, but sometimes people don’t fully grasp the benefits. Studies suggest database applications consists of 20-40% data-access code. If that’s true, applying the low end projection on an application with 100,000 lines of code would result in 20,000 lines of data access code. That’s a lot of code to keep synchronized with a database. Extend this projection over several big applications that access the same databases, and multiply this over several departments in an organization, and the magnitude of the development and communication challenges becomes clear. Traditionally, database applications would access databases directly, so as the DBA’s maintain and evolve the database (e.g. table splitting, column changes, etc.), application code would need to be carefully updated and edited to support the changes. Search and replace is not enough to update the data-access code and mistakes can easily happen — some portions of code get updated, others don’t which could leave applications unstable and could ultimately result in data corruption. The devil is in updating countless access points of the same database object in the application code.

Using the EDM and EF shields applications from having to reference database objects directly in code by centralizing the application/database mapping in one place. If all applications use the same Entities, then updates to the underlying mapping of the entity to the database can be easily maintained and reflected across all applications. The EDM and EF allows databases to evolve independently from applications, without triggering an avalanche of application code changes. The EDM and EF acts as a powerful buffer between the two worlds – protecting investments and logic in application code while allowing DBAs to evolve databases to meet the needs of an organization. Microsoft is very excited about the EDM and EF and believes that these free technologies will be instrumental in helping people build better applications, more efficiently.

Good resources