[Entity Framework series] Overview, entityoverview

Source: Internet
Author: User

[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 Framework 4 and Visual Studio 2010 POCO support, lazy loading, testability improvements, customizable code generation and the Model First workflow
     
     
     
     
     
     

 

Not complete...


What is Entity Framework? net40 is installed on my computer. Do I need to install Entity Framework?

It seems that you are not engaged in Database Programming and do not need to install it. Entity Framework is mainly used to convert relational databases, that is, SQL Server, so that programmers can operate the database in the form of classes when writing C # code, rather than using SQL strings.

How to build a NET Entity Framework distributed application system Framework

To. net FrameWork 3.5 sp1, Entity FrameWork is launched. Different providers can be implemented to support different databases. (Of course, Microsoft still only has built-in SQL Server Provider and other database providers, third-party development is required ). EF and linq. This is. net development ,. net programmers operate data in object mode and query data in programs using SQL-like syntax, which greatly reduces the tedious work of constructing SQL statements and can focus more on writing business logic code. However, in a distributed application system with multiple layers of architecture, when entity objects are remotely serialized to the client, these entities are separated from their data context (that is, the object container, the client cannot directly query entities and perform CUD (Create, Update, Delete) operations. The following uses SQL Server as the database, Remoting + Entity Framework3.5 as the data service layer, and WinForm as the client, describes how to use the EF framework to build a multi-layer distributed application system. Ii. Technical Analysis 1. objects transmitted through a remote client are in the separated State (the attribute value of EntityState is Detached). Therefore, when the server in a multi-tier application updates or deletes an object, the key is how to append an object to an object container. On MSDN, queries for separated entities and CUD operations are described as follows: 1) When an additional object (Entity Framework) executes a query within an object context of the object framework, the returned object is automatically appended to the object context. You can also attach objects obtained from the source rather than from the query to the object context. You can append objects that were previously separated, objects returned by NoTracking queries, or objects obtained from outside the object context. You can also append objects stored in the view State of ASP. NET applications or objects returned from remote method calls or Web services. Use one of the following methods to attach an object to the object context: · call AddObject on ObjectContext to append the object to the object context. This method is used when the object is a new object that does not exist in the data source. · Call Attach on ObjectContext to append the object to the object context. This method is used when the object already exists in the data source but is not currently attached to the context. For more information, see How to: attach related objects (Object framework ). · Call AttachTo of ObjectContext to attach an object to a specific object set in the object context. You can also perform this operation if the object has a null (Nothing in Visual Basic) EntityKey value. · Call ApplyPropertyChanges on ObjectContext. This method is used when the object already exists in the data source and the detached object has the attributes you want to save for updating. If this object is simply appended, the property changes will be lost. For more information, see How to: Apply changes to separated objects (Entity Framework ). 2) View Code2., the sample code of the application's changes to the separated objects (Entity Framework), implements dynamic condition query. In the local environment, we can dynamically construct a Lambda Expression Tree for dynamic condition query for Linq. However, in a remote environment, Lamdba expressions do not support remote serialization and transmission, it can only be implemented through the CreateQuery method of ObjectContext. Fortunately, Microsoft later provided a Dynamic query extension library named Dynamic. cs is more convenient to use, so it is used for implementation. 3. In EF, the core abstract class is ObjectContext, which is derived from the object container. the CUD method on the object container is actually implemented by calling the CUD operation method of ObjectContext. 1) AddObject (string, object): Indicates adding an object to the object container. If the EntityKey value of the object is null, no matter whether it is... the remaining full text>

Related Article

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.