Databases Reference
In-Depth Information
Because there is only one set of parameters, mapping of the delete procedures is also
straightforward. If the parameter names match the names of the entity properties, the
Entity Designer maps them automatically. You only need to make sure that the
RowsAffected parameter has a check mark in the Rows Affected Parameter column.
NOTE
Although it would be possible to revoke direct data access permissions from an appli-
cation using Entity Framework and force it to rely strictly on the Select, Insert, Update,
and Delete stored procedures, doing so would require an additional effort to implement
and take away most of the strengths and productivity improvements offered by the
Entity Framework. Stored procedures are a great performance and security optimization
option, but when followed to the extreme, this approach defeats most of the reasons to
use a LINQ-based framework in the first place.
Summary
The ADO.NET Entity Framework is an ORM framework developed by Microsoft as part of
the .NET Framework. It is built on top of the Entity Data Model, which includes a storage
model, describing database tables, views, and stored procedures; a conceptual model,
describing application entity types and functions; and a mapping model that connects
conceptual definitions to their physical implementation in the storage model.
The Entity Framework has first-class design tools in Visual Studio for working with entity
data models, including the Entity Designer, Model Browser, and Mapping tool windows as
well as the Update Wizard. Together, these tools allow developers to use the database-first
approach, where the entity model is reverse-engineered from an existing database, as well
as the model-first approach, where the database is generated from an entity data model
created from scratch.
Based on the conceptual model, the Entity Framework generates strongly-typed applica-
tion classes, including entity classes, which encapsulate individual rows of data, and an
ObjectContext , which encapsulates a collection of entity sets (tables) and functions
(stored procedures). Entity Framework allows using LINQ queries to retrieve entity
instances from the database. The LINQ queries are compiled in a form of LINQ expres-
sions. At run time, the LINQ expressions are translated into dynamic, parameterized SQL
statements and sent to the underlying database engine for execution. Upon return, the
ObjectContext materializes the records returned by the SQL queries are in the form of
entity instances, allowing using strongly-typed .NET code to query and manipulate data-
base information.
Entity Framework provides an abstraction layer that allows you to build a holistic view of
the information in a conceptual model independent from the underlying storage schema.
In particular, a single entity type can be mapped to multiple tables. Entity Framework also
supports entity inheritance and allows mapping class hierarchies using table-per-type,
table-per-concrete type, and table-per-hierarchy strategies.
 
Search WWH ::




Custom Search