Database Reference
In-Depth Information
Console.WriteLine("The singular of {0} is {1}", people,
service.Singularize(people));
Following is the output of the code in Listing 7-3:
The plural of Person is People
The singular of People is Person
7-5. Retrieving Entities from the Change Tracker
Problem
You want to create an extension method that retrieves entities from the change tracker in order to perform some
operation before the data is saved.
Solution
Suppose that you have a model like the one shown in Figure 7-7 .
Figure 7-7. Our model with technicians and their service calls
In this model, each technician has service calls that include the contact name and issue for the call. You want
to create an extension method that retrieves all entities in the model that are in the Added, Modified, or Unchanged
state. To do this, follow the pattern in Listing 7-4.
Listing 7-4. Creating an Extension Method That Retrieves All of the Entities in the Added, Modified,
or Unchanged State
class Program
{
static void Main(string[] args)
{
RunExample();
}
 
Search WWH ::




Custom Search