The first contact with EF, read some information, the understanding of the EF structure of the following records:
At the core of EF is the EDM----Entity Data Model (. edmx). It consists of three components: a conceptual model (. csdl file), a storage model (. ssdl file), a mapping specification (. msl file).
Conceptual model: In EF, it refers to an entity class. public class class Name {
Attribute 1;
Attribute 2;
...}
Storage model: In EF, it refers to the entities in the database (the form in which the relationships of individual entities are pinned to the table).
Mapping: Connect the conceptual model and the storage model for operation.
That is: (conceptual model) entity. Properties <----> (storage model) entities. Fields
Understanding EF First understands the following concepts, which demonstrate the correspondence between the conceptual model and the storage model. Inside the parentheses are the storage models, which are specific instructions for easy comprehension
1: Entity class: Entities. Its name is typically the table name of the associated database table. It inherits from the Entityobject class. Used to describe the attributes of an entity, and an entity class defines one or more properties.
(In the conceptual model: an object of an entity class is a row in a table)
2: Entity set: objectquery< entity >. One or more entity classes form an entity set.
(In the conceptual model: a table consisting of multiple rows of data)
3: Entity container: EntityContainer it inherits from ObjectContext. The entity set is defined in the container.
(In the conceptual model: a database consisting of multiple tables)
4: Entity key: EntityKey refers to the name of an attribute in an entity class.
(In the conceptual model: is a collection of fields.) )
The containment relationship between them is: Entity container---> Entity set-----> Entity class-----> entity key
When we add an associated. Net entity Date model, both the entity class and the entity container are automatically generated.
EF (Entity framwork) structure