Entity Framework to learn the primary chapter 6--entityclient

Source: Internet
Author: User

The System.Data.EntityClient namespace is a. NET Framework Data Provider for the Entity Framework. The EntityClient provider interacts with the Entity Data Model using storage-specific ado.net data provider classes and mapping meta data. EntityClient first converts an action performed on a conceptual entity to an operation performed on a physical data source. The result set returned by the physical data source is then converted to a conceptual entity.

The classes under EntityClient have several of the following:

L EntityConnection

L EntityCommand

L Entityconnectionstringbuilder

L Entityparameter

L EntityDataReader

L Entityparametercollection

L Entityproviderfactory

L Entitytransaction

From the names of the classes, we know what their role is. Here, it is no longer one by one explained. Learn them directly from the instance code.

L EntityConnection:

Instance Code 1:

string con = "name = NorthwindEntities";

using (EntityConnection econn = new EntityConnection(con))

{

string esql = "Select VALUE c from NorthwindEntities.Customers as c where c.CustomerID='ALFKI'";

econn.Open();

EntityCommand ecmd = new EntityCommand(esql , econn);

EntityDataReader ereader = ecmd.ExecuteReader(CommandBehavior.SequentialAccess);

if (ereader.Read())

{

Console.WriteLine(ereader["CustomerID"]);

}

Console.WriteLine(ecmd.ToTraceString());

}

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.