Database Reference
In-Depth Information
using (var context = new EF6RecipesContext())
{
Console.WriteLine("All Athletes");
Console.WriteLine("============");
foreach (var athlete in context.Athletes)
{
Console.WriteLine("{0} weighs {1} Kg and is {2} cm in height",
athlete.Name, athlete.Weight, athlete.Height);
}
}
The following is the output of the code in Listing 10-22:
All Athletes
============
Rob Achers weighs 80 Kg and is 170 cm in height
Chuck Sanders weighs 82 Kg and is 171 cm in height
Nancy Rodgers weighs 59 Kg and is 166 cm in height
10-9. Using Stored Procedures for the Insert and Delete Actions
in a Many-to-Many Association
Problem
You want to use stored procedures for the Insert and Delete actions in a payload-free, many-to-many association.
These stored procedures affect only the link table in the association and not the associated entities.
Solution
Let's say that you have a many-to-many relationship between an Author table and a Book table. The link table,
AuthorBook, is used as part of the relationship, as shown in Figure 10-11 .
Figure 10-11. A payload-free, many-to-many relationship between an Author and a Book
 
Search WWH ::




Custom Search