To test the ADO. NET Entity Framework-Tools

Source: Internet
Author: User

ESqlBlast is currently a good query tool for EF, similar to the query Analyzer of MS-SQL SERVER, provides a simple intelliisense function, you can query EDM through eSQL (Entity SQL, output query results. In addition, it can directly view the current entity set and SQL statements generated through eSQL. ESqlBlast is very convenient to use. This article uses eSqlBlast to implement some query instances to familiarize themselves with how to use eSqlBlast.

1. To complete the instances in this article, you need to make the following preparations:

  1. Upgrade Visual Studio 2008 and. NET Framework 3.5 to SP1. Click to go to the upgrade address.
  2. Install SQL server 2005, and use the EXPRESS version of SQL SERVER in VS 2008.
  3. Download and append the database: Click to download DemoDbV2.
  4. Maps the database to the object. For more information, see the article "ADO. NET Entity Framework test-Shadow.
  5. Download eSqlBlast: Click to switch to CodePlex.

Ii. Compile the eSqlBlast Project

. No more nonsense.

3. Set the EDM output format

When configuring eSqlBlast connections, you need to use the csdl, ssdl, and msl files. These three files are generated by the. EDM file, but in VS2008SP1, these three files are not output by default. Therefore, we need to set the "Metadata Artifact Processing" attribute of the EDM file to "Copy to Output Directory ". See.

Figure 1

In this way, after re-compilation, three files corresponding to the conceptual model will appear in the project Output Folder. For future use.

4. Query

1. Configure the connection

Run microsoft.samples.data.esqlblast.winshell.exe. The following interface is displayed:

Figure 2

Here, we need to configure two parts. The first part is the connection string, which can be copied from the app. configConnectionString element. Note that you only need to copy the part after "provider connection string =. Remove the two "& quot ;". In the Metadata section, you can click Add Files and Add the three Files that have just been generated at one time. Of course, if you are lazy, you can also directly point to the Folder with the three files through Add Folder. The effect is basically the same.

After the configuration is complete, you can click "Connect" to complete the connection. After correct connection, the status bar at the bottom shows the green "Connected.

Figure 3

2. view the conceptual model Overview (this step can be omitted without affecting the query)

To view the Overview of the current conceptual model, go to the second page and select. click "Render" after the csdl file to view the parsed file. the "entity set", "entity class", "complex type", and all "Connections" of the conceptual model described by csdl ". See.

Figure 4

3. Enter an eSQL statement.

Let's go to the most interesting part. Click the "Query" tab and use eSQL for some queries. We recommend that you do not use the "copy and paste algorithm". Enter eSQL to try eSqlBlast to write eSQL. ^_^

We have two instances:

1. Check all the laptops.

Select ValuePFromNbWhEntities. NotebookAsP;

2. query the status of two laptops from the third record (sort brand names)

Select ValuePFromNbWhEntities. NotebookAsPOrder ByP. BrandSkip2Limit2;

When the input is from, intelligent sensing will appear, such:

Figure 5

4. View output results

The results are also clear:

Figure 6

The first part is the eSQL statement we output;

The second part is the generated SQL statement;

The third part is the number of Result Records;

Finally, the record details are listed.

The result of the second example is as follows:

Figure 7

V. Summary

Although eSqlBlast is not perfect, it is a little complicated to write a connection string and select three files at the beginning (Unlike SQL SERVER, you can choose a SERVER or enter a user name or password to connect to it) smart sensing is not perfect, and does not support parameter-based queries at the moment. However, its query function and the function of viewing generated SQL statements are quite practical. In addition, eSqlBlast is a good tool for learning and debugging eSQL.

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.