Create and obtain physical database files and database references in a Windows Phone local database-obtain the physical files of the referenced database

Source: Internet
Author: User

Windows Phone OS 7.1 allows you to store relational data in applicationsProgramThe local database of the independent storage container. The Windows Phone application uses LINQ to SQL to perform all database operations. The LINQ to SQL is used to define the database architecture, select data, and save the changes to the basic database files that reside in the independent storage; will you be excited when it comes to LINQ to SQL? In the window phone, we can persistently store data in this way :), this article will lead you to build the first Windows Phone local database application-contact management.

This series includes the following:

1. Create a database

2. Find the database file from the independent storage and copy it to the PC.

3. Reuse the database in 2 (other programs use the database files in 2 or use the initial data in 2)

 

As described in the previous article, the local database in Mango uses LINQ to SQL to create databases, create tables, initialize built-in data, and add, delete, modify, and query databases, but where is the database we created? How can I use this database for other applications? Because we need to share data or use one or two programs to maintain the built-in data in the database, can other applications use this maintained database? The answer is yes. In fact, the program we created previously can be calledHelper application, because we only use it to create a database, create a table, initialize built-in data, or maintain the data in it; but it is finally released to the application market and provided to users for real use, it cannot be created when a user opens an application for the first time, which is too costly. Today, we mainly find the physical database file we created in the previous article, copy it to our PC. With physical files, I will introduce how to reference this database in other applications in the next article;

Okay, let's go.

 

To find the physical database file we created, you must useThe independent storage resource manager (isetool. EXE) is a command line tool in the Windows Phone SDK. It can be used to list, copy, and replace files and directories in the independent storage (the Independent storage only allows access by the current application );

To use the independent storage resource manager, you must install our application on the mini or test machine and the simulator or test machine is running. Its file directory is:

    • Program Files \ microsoft sdks \ Windows Phone \ v7.1 \ tools \ isolatedstoragepolicertool

    • Program Files (x86) \ microsoft sdks \ Windows Phone \ v7.1 \ tools \ isolatedstoragepolicertool

 

It supports the following command options:

TS

(Taking snapshots) copy files and directories stored independently from devices or simulators to your computer.

RS

(Restoring snapshots) replace files and directories stored independently on devices or simulators with files and directories on your computer.

Dir

List objects and directories in a specified directory that is stored independently. If no directory is specified, the files and directories in the root directory are listed.

Device-Folder

Specify a directory that is stored independently on the target device or simulator.

XD

Indicates that the target is a simulator.

De

Indicates to target a stacked device.

Product guid

In the wpappmanifest. xml file of the application to be tested, specifyProductid.

Desktop-Path

Specifies the directory on which files are written to or copied from a computer. When usingTSWhen copying a fileDesktop-PathCreateIsolatedstore. If the specified directory already existsTSCommand will overwrite the contents of the directory without issuing any warning.

 

Okay, let's get started:

1. First find the product guid of our application:In wpappmanifest. XML, the directory in the solution is,


Find productid in the file, and my demo is: ac5b5d62-573c-4134-b290-0ad4f678ad7f

2. Publish the application to the simulator or test machine (I will run it again here, so there will be data I added)

3. Use the command line tool to switch the directory to the isetool. EXE directory, and first list the file directories in the independent storage:

The input command is: isw.l.exe dir XD ac5b5d62-573c-4134-b290-0ad4f678ad7f

TIPS:Because I use a simulator, XD is used in the command line (with the simulator as the target). If you are a test machine, you need to use de

Output:

Are you familiar with the database file we created? Mycontactor. SDF.

4. Copy to PC:

Enter the command: isw.l.exe ts XD ac5b5d62-573c-4134-b290-0ad4f678ad7f "D: \ ISODATA"

TIPS: Because I use a simulator, XD is used in the command line (with the simulator as the target). If you are a test machine, you need to use de

Output:

Okay. We are prompted to download the specified D: \ ISODATA directory.

5. Find the physical file: go to D: \ ISODATA to find our independent storage file

Haha, as scheduled, we found the physical database file,

Unfortunately, there is no way to open this physical file directly.

The next article describes how to reference the database files in another application;

 

Demo, this article is only to find the database files created earlier, so the demoCodeNo changes ..

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.