Windows Phone local database (sqlce): 3. [Table] attribute)

Source: Internet
Author: User

A newbie recently wants to learn about the Windows Phone database and find some short tutorials. Because it is in English, it is translated by the way. The English level is not good. It is estimated that there are many mistakes in the text. If you have any children's shoes that are unfortunately read, please keep in doubt about the translation quality and give me more advice.

This is the original article address: http://www.windowsphonegeek.com/tips/windows-phone-mango-local-database-sql-ce--#table%-attribute

The text is as follows:

 

This is the third article in the Windows Phone mango local database (sqlce) series. To get you started using databases in Windows Phone mango, this series of short clips will cover all the things you need to know. In this case, I will talk about using [Table] attribute when you use a Windows Phone mango local database.

1. What is [Table] attribute? You can use this attribute to specify a class as an object class related to a database table or view. The class with this attribute will be used as the persistence class in LINQ to SQL. You can use the name attribute of the tableattribute to specify the name of a table, and you can use the schema name to specify the table name. If you do not use the name attribute to specify a name, the table name is the same as the class name by default. In addition to associating a class to a table, you need to indicate each field or attribute to be associated with a data table column. Note: Only single-Table ing is supported for LINQ to SQL. That is, an object class must be correctly mapped to a database table. You cannot map Multiple object classes to a database table at the same time. 2. How to use [Table] attribute Example 1: A table with a name
1 [Table(Name = "Countries")]2 public class Country3 {4     //class contents here5 }

Example 2: A table without a name

1 [Table]2 public class Country3 {4     //class contents here5 }
This article describes how to use [Table] attribute in a Windows Phone mango local database. Continue to pay attention to the following articles.

 

 

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.