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 323 | Next

Scott Klein

"Professional LINQ"


Prior to Beta2, attribute-based mapping was supported via the System.Data.Linq namespace. If you
then installed Beta2 and tried to compile your code, you received a lot of compile errors. That is because
attribute-based mapping is now supported via the System.Data.Linq.Mapping namespace.
Using the Database Attribute
The Database attribute is used to specify the name of the database when defining a mapping between a
database and object. This attribute has one property, Name, which is used to hold the name of the database
to which you are defining a mapping.
Here??™s an example of the Database attribute being applied to a class to define a mapping:
[Database(Name="AdventureWorks")]
public class AWDB
202
Chapter 10: LINQ to SQL Overview
{
//
}
The use of this attribute is optional, but if used, the Name property must be used. Typically, you would
use this property when a database name is not supplied in the connection string.
Mapping Tables
Database tables are represented by entity classes in LINQ to SQL. An entity class is a normal class like
one that you might define, except that it is annotated with a specific tag that maps, or associates, that
class with a specific database table.


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