ExecuteDynamicInsert(instance);
}
294
Chapter 15: Advanced LINQ to SQL Topics
Figure 15-11
Notice that as you start typing, IntelliSense pops up and gives you the list of method definitions. Select
the one you want and just add the appropriate custom validation logic to this method. Then add the
appropriate call, such as the one shown in this example: this.ExecuteDynamicInsert():
As stated before, these methods are automatically called when you call the SubmitChanges() method on
your DataContext.
Figure 15-12
295
Part III: LINQ to SQL
Pluralization of Classes in the O/R Designer
You might notice that as you drag-and-drop database objects onto the O/R Designer, the object names
might change. This happens whenever your object name is a ??????plural,??™??™ such as Contacts, Employees, or
Categories. Any object name that ends in ??????s??™??™ or ??????ies??™??™ is automatically renamed from plural to singular.
Thus, Employees becomes Employee, and Categories becomes Category.
The reasoning behind this is that it more accurately shows that the entity class maps to one record of
data.
Pages:
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470