2014 began to contact the Entity Framework 6 also nearly two years, with it has precipitated a mature architecture, also used to develop a lot of large and small products and projects, until this time, really have time to review, re-learn it, in order to let you know more about the Entity framework 6, and want to take
Label:Log tracking in the EF Entity Framework is usually done by writing a log entity class and verifying the property's original value when the data is saved for log tracking. Of course, you can also use some third extension libraries for example: Entity Framework extended
Using tools to track the SQL generated by EFWhen using an ORM framework such as the Entity Framework, SQL is transparent to the user, and often many people do not care about the SQL generated by the ORM, but when the system has performance problems, it must focus on the generated SQL to find the problem.Friends who have used TopLink know very much as long as you
The problem of Cross-database query of Entity Framework is solved, and the modernization of the blog Park is another step forward.
In the previous article,The modernization of the blog Park-automapperWe have encountered an application scenario where the number of fields returned by the database query is less than the attribute of the entity class. By default,
Entity Framework 6 Recipes 2nd Edition (10-10), entityrecipes
10-10. The insert, update, and delete operations inherited by TPH are mapped to the stored procedure.
Problem
TPH inherits the model and maps its insert, modify, and delete operations to the stored procedure.
Solution
Assume that the database has a Product t
Entity Framework 6 Recipes Chinese translation series (44), entityframework
For the original intention of translation and why I chose Entity Framework 6 Recipes, see the beginning of this series.8-4 Use the value object (Complex Type -- Also called composite Type) attribute in POCO
Problem
You want to use value objec
MySQL only supports default values and Automatic updates for timestamp that cannot be used for rowversion. Therefore, you can only set row Version in the app in MySQL. Non-existent disadvantages: 1.ASP. NET slow (no options for IIS application initialization and recycle configuration are set) 2.Entity Framework slow (not set per request one dbcontext and generate views) 3.
This article supporting source code
This article uses the following techniques:
LINQ to SQL, ADO. NET Entity Framework and SOA
Directory
To create a data access layer
Persisting individual objects
Tracking changes across service boundaries
Configuring clients
Summarize
To date, Microsoft has published two products for developers that are designed to reduce the impedance mismatch between relational
Let's start with Orm, many years ago, because. NET's open source component is not as well developed as it is now, let alone an open source ORM framework, for project needs, and when OOP arose (not always, in a project full of SQL statements), began to write the ORM framework. To develop an ORM framework, first understand the ORM concept.ORM Object Relational mapp
Entity Framework not only facilitates operation, but also considers user friendly interaction. The perfect combination of ef4.0 and vs2010 is also a reason for us to choose it. Compared with Nhibernate Microsoft, this is indeed a good job.
The following is a simple example of codefirst.
We are still following the previousArticleEntity Framework Quick Start --
=true; Console.WriteLine ("post-modification status:"+ entityentry.state);//Modifieddb. SaveChanges ();3. Deletion is also true New studentaddress { u222pdate, "address " + DateTime.Now }; Db. Studentaddress.attach (address); // Detached db. Studentaddress.remove (address); // or change its status to: entitystate.deleted; Db. SaveChanges ();4. Source code--Each change in the data will have a corresp
11-3. Returns a computed column for a "model definition" functionProblemTo return a computed column from the model definition functionSolution SolutionsSuppose we have an employee entity with attributes: FirstName, LastName, and birthdate, such asFigure 11-3.Figure 11-3. An Employee entity with a few typical propertiesWe want to create a "model definition" function that returns the merged full name of First
If you have been working with the ADO. NET Entity Framework, you have probably been extremely eager to get your hands on the next version that is now part of Visual Studio 2010 and. net 4.0. long referred to as "EF version 2," this version is now called Entity Framework 4 or EF4, to align with. net
Entity Framework tutorial -- DBContext, entitydbcontext
DBContext:
In the previous section "create an object data model", EDM creates a SchoolDBEntities class for us.System. Data. Entity. DbContextThis class. This DbContext is called the context class in EF.
Before EF4.1, the context class generated by EDM is derived from the ObjectContext class. It is a bit dif
12-5. Automatically delete associated entitiesProblemWhen an entity is deleted, you want to automatically delete its associated entitiesSolution SolutionsSuppose you have a table structure consisting of a course (subject), course classes (course), as well as enrollment (enroll students in elective classes) as shown in Figure 12-5:.Figure 12-5. the Course, Class, and enrollment tables in our databaseA model is generated from the table above, as shown i
. Objectcontext.createqueryvar final = from E in entrieswhere e.name = = "Mark"Select E;var f = (system.data.objects.objectqueryvar s = f.totracestring ();return entries;}If you output the value of s, you can see:SELECT[Extent1]. [Simpleentryid] As[simpleentryid],[Extent1]. [Simpleentryname] As[simpleentryname]From[man]. [Myentry] AS[EXTENT1]WHERE N ' Mark ' = [Extent1]. [Simpleentryname]This is the typical TSQL generated by EF, and you will notice that the LINQ filter is applied to the SQL stat
, because the class already implements the Ifullaudited interface.Note: All audit interfaces and classes have a generic template in order to navigate the definition properties to your user entities (such as:icreationaudited(3) Active status/Idle status (active/passive)Some entities need to be marked as active or idle. Then you can take the action of Active/passive state for the entity. Entities created for this reason, you can extend the Ipassivable i
[Entity Framework series] Overview, entityoverview
This article describes the history of the EF version, and describes the background and history of a technology. It helps us with the following:
To put it bluntly, let's start with the question:
EF (or EF 3.5) initial release
. NET 3.5 SP1 Visual Studio 2008 SP1
Basic O/RM support using the Database First workflow
EF 4
. NET
Directory
1 Concept 1
2 ado.net Entity Framework 2
2.1 Architecture 2
2.2 Description 2
2.3 EntityConnection 4
2.4 EntityCommand 5
2.5 data access through the EntityDataReader method 6
2.6 Data access via ObjectContext return objectquery
Concept
LINQ to Entities
A LINQ technology that enables developers to create flexible, strongly typed queries against the
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.