SEARCH
0-9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Prev | Current Page 327 | Next

Scott Klein

"Professional LINQ"


The following example illustrates how to map a few properties with several columns of the
Person.Contact table in the Adventureworks database:
[Column(DBType = "nvarchar(8)")]
public string Title;
[Column(DBType = "nvarchar(50)")]
public string FirstName;
[Column(DBType = "nvarchar(50)")]
public string MiddleName;
[Column(DBType = "nvarchar(50)")]
public string LastName;
[Column(DBType = "nvarchar(50)")]
public string EmailAddress;
[Column(DBType = "int")]
public int EmailPromotion;
Add this to the Table mapping, and you have the following:
[Table(Name = "Person.Contact")]
public class Contact
{
[Column(DBType = "nvarchar(8) not null")]
public string Title;
[Column(DBType = "nvarchar(50) not null")]
public string FirstName;
[Column(DBType = "nvarchar(50) not null")]
public string MiddleName;
[Column(DBType = "nvarchar(50) not null")]
public string LastName;
[Column(DBType = "nvarchar(50) not null")]
public string EmailAddress;
[Column(DBType = "int")]
public int EmailPromotion;
}
Only those columns that are defined are used to persist data to the table and retrieve data from the
database.


Pages:
315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339
hotel jelenia góra Russian bride Free English grammar and study guid powiekszenia wielkoformatowe counter strike 1.6