291
Part III: LINQ to SQL
DataContext Mapping for Stored Procedures/Functions
DataContext methods are those methods of the DataContext class that run stored procedures and
functions. In the context of the O/R Designer, the DataContext class is the LINQ to SQL class you just
created; it acts as a channel between the database and the entity classes mapped to the database.
When a stored procedure or function is dragged from the Server Explorer and dropped onto the O/R
Designer, it is displayed in theMethods pane, as shown in Figure 15-7. This pane lists all the DataContext
methods you have created via the O/R Designer.
Figure 15-7
The return type of the generated DataContext method can depend on where you place the item in the
O/R Designer:
??‘ If you drop an item onto an existing entity class, the return type will be the type of that entity
class for that DataContext method.
??‘ If you drop an item onto an empty entity class or an empty area of the designer, the return type
will be an auto-generated type for that DataContext method.
Pages:
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466