Entity classes are the objects which represent the database tables. In the previous example, the table collections of the Icrecreams
data context, contain three tables for which we need to add the definitions of each table with its columns and its attributes.
System.Data.Linq.Mapping
is the namespace that contains the definition for all the attributes. We have to include this in the project to specify the attributes.
The definition of the Categories
table would look like this:
[Table(Name = "Categories")] public class Categories { private int categoryID; private string category; private string description; [Column(Name= "CategoryID", IsPrimaryKey=true, IsDbGenerated=true, DbType="int NOT NULL IDENTITY",CanBeNull=false)] public int CategoryID { get { return categoryID; } set { categoryID = value; } } [Column(Name="Category", DbType="nvarchar(1000)")] public string Category { get { return category; } set { category = value; } } [Column(Name="Description", DbType="nvarchar(1000...