List of Entity frameworks
EF integrates a series of applications to facilitate the development of data. Unlike Microsoft's previous data access technology, EF and Visual Studio together constitute a comprehensive, model-based ecosystem, you can use it to develop a wide range of data-oriented applications. For example, use Asp.net and Sliverlight to develop desktop programs, server programs, Internet programs, and distributed multi-host programs using WCF.
Model
EF actually does all the work to build a model. The meaning of a model in EF does not come out of thin air, but gradually evolves. Many areas of EF are affected by the genetic effects of previous technologies and patterns. For example, the concept-logic-physical hierarchy design method is used for the object relationship diagram and for a long time.
EF uses Entity Data Model (EDM) to mark the Model. EDM is a formal structure used to define the data used in a program, it defines the data type, specifies which type of association is allowed, schemas supported by the model, and ing in different schemas. (Schemas is not easy to translate. In terms of databases, it can be called schema, db-> schemas-> tables ). The model you created for the program corresponds to the entries in EDM. This is a bit like EDM is a Class, and the model is an Instance that meets its needs ), but they are just a bit different. EDM defines the structure of the model.
Well, there are a lot of terms involved now. A Model consists of three layers: Concept layer, storage layer, and ing layer. The syntax of each layer is expressed in an XML file, and the schema is also defined in this XML. For convenience, the three different XML files on the three layers are tied together to form a file with the suffix. edmx.
The concept layer model is actually accessible to developers. There is no indication of the physical storage layer in this layer, which is defined in CSDL (Conceptual Schema Definition Language. VS provides a fully functional design interface that allows you to directly operate entity types and relationships on the concept layer. The concept layer model is defined in CSDL.
Any useful program requires data persistence operations. At the storage layer, we define data storage. It includes definitions of tables, columns, and data types, which are recorded in SSDL (Store Schema Definition Language.
The ing layer between the concept layer and the storage layer maps the models of the two layers. For example, how to associate the attributes in this class with the field in the database. These details are defined in MSL (Mapping Specification Language.
Terms
EntityType (entity type) is a class that defines a new type. Its instance is called Entity, but it is often called Entity. Entity Type defines some attributes, including Scalar, Complex type, and navigation ). 1-1, defines two entitytypes: Employee and Task. The relationship between them is one-to-many.
Figure 1-1
Association. For example, the relationship between two entity types is Association. There are one-to-many, many-to-one, and many-to-many and associated with itself. Each EntityType is an EntityKey attribute, which is equivalent to a primary key identifier. It is usually determined by the actual primary key of the underlying database.
EntitySet (entity set) the entity set is a collection of some EntityType instances, or contains its derived type. In most cases, instances of the given EntityType are in the same entity set, but there are also exceptions, called MEST (Multiple EntitySets per Type). We will introduce an example later.
ComplexType (complex type) is a collection of related attributes. A complex type does not have a primary key identifier like an object type. It is more like combining a bunch of related attributes to form a new attribute. Figure 1-2 is a good example. Customer has a normal scalar attribute (Id, Name, Phone), but at the same time there are two complex attributes BillingAddress and ShipToAddress, both of which belong to the same complex type of Adrress. The Address type contains various information, but none of them can be called the primary key. They are just a set of related attributes.
Figure 1-2
Navigation properties (Navigation attribute), which has a direct foreign key relationship in the database, EF can use it to navigate from a table to another table.