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.