However, those mappings don??™t exist yet, so create them now by adding the following code
below the table mapping from the first example. This code creates two mapping classes, one for the
contacts and the other for the products.
[Table(Name = "ContactPart")]
public partial class ContactsPart
{
private int _contactID;
private string _title;
private string _firstName;
private string _lastName;
[Column(Name = "ContactID", Storage = "_contactID", DBType = "int")]
public int ContactID
{
get
{
return this._contactID;
}
set
{
if ((this._contactID != value))
{
this._contactID = value;
}
}
}
[Column(Name = "Title", Storage = "_title", DBType = "nvarchar(50)")]
public string Title
{
get
{
return this._title;
}
set
{
if ((this._title != value))
{
this._title = value;
}
}
}
[Column(Name = "FirstName", Storage = "_firstName", DBType = "nvarchar(50)")]
public string FirstName
236
Chapter 11: LINQ to SQL Queries
{
get
{
return this._firstName;
}
set
{
if ((this._firstName != value))
{
this._firstName = value;
}
}
}
[Column(Name = "LastName", Storage = "_lastName", DBType = "nvarchar(50)")]
public string LastName
{
get
{
return this.
Pages:
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385