This is the third installment of the "Windows Phone Mango Local Database (SQLCE)" series of short articles. To get you started using the database in Windows Phone Mango, this series of short film articles will cover all the knowledge you need to know. This time I will talk about you using the Windows Phone Mango Local Database when you use [Table]attribute.
1. [What is Table]attribute?You can use this property to specify a class as an entity class related to a database table or view. LINQ to SQL will have a class of this property as a persisted class. You can use the Name property of the Tableattribute property to specify the name of a table, and you can use the schema name to qualify the name of the table. If you do not use the name attribute to specify a name, the table name defaults to the same as the class name. In addition to associating a class to a table, you need to indicate each field or property that you intend to associate to the data table column.
Note : LINQ to SQL supports only single table mappings. That is, an entity class must be correctly mapped to a database table, and you cannot map multiple entity classes to a single database table at the same time. 2. How to use [Table]attributeExample 1: A table with a name
"countries")]class country{//class contents here5}
Example 2: Table without a name
[Table] class country{//class contents here5}
This article I talked about using [Table] attribute in the Windows Phone Mango Local database. Keep your eye on the next article.