On the road Windows Phone (iv) query LINQ to SQL

Source: Internet
Author: User
Tags resource visual studio 2010

One day, a reader emailed me and asked me if I was interested in doing a translation application, according to the "Food Translation Court-English translation of Chinese menu" to the Chinese name into English dishes, because he often eat with foreigners, so I hope that his WP mobile phone can have one such application, and we just take this opportunity to explore LINQ to SQL queries and related optimization techniques.

Use the existing database

Windows Phone 7.5 Adds support for the SQL Server CE database, but Visual Studio 2010 does not provide database tool support for Windows Phone's projects, such as table design and entity class generation, and The database must also be accessed through LINQ to SQL.

In general, the application creates the database in isolated storage at the first run, and then saves the user-created data while it is running, but instead of creating a new database, it uses an existing database, which is deployed with the application to the user's mobile phone. First, add the database to the project through the Project menu in Solution Explorer, as shown in Figure 1.


Then, in properties, set the value of the database build action to content, as shown in Figure 2, so that the database will be packaged into the XAP file as a stand-alone file. In contrast, if we set the value of the build action to resource, then the database will embed the DLL file as a resource, which will cause the application to load longer and should be avoided as much as possible.



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.