In other words, you can create DataContext methods that return auto-generated types by dragging
a stored procedure onto an empty area of the O/R Designer. Likewise, you can create DataContext
methods that return the type of the entity class by dropping a stored procedure on an existing entity
class in the designer.
The return type of the DataContext method can be changed by opening the Properties window and
changing the Return Type property for that method, as shown in Figure 15-8.
Once the DataContext method has been defined the method (stored procedure) can be called (which
executes the stored procedure) passing the necessary parameters and return the data.
292
Chapter 15: Advanced LINQ to SQL Topics
Figure 15-8
Calling Stored Procedures to Save Data Using Entity
Classes
By default, the LINQ to SQL runtime handles the INSERT, UPDATE, and DELETE functions of an entity class.
However, you can also use stored procedures to create DataContext methods to provide this functionality.
These stored procedures can also be added to the O/R Designer as standard DataContext methods
just like standard SELECT stored procedures.
Pages:
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467