Database Reference
In-Depth Information
Figure 13-12. Map the ResumeDetail entity to the Resume table. Map the ResumeId and Body properties as well
6.
Select the ResumeId property on the ResumeDetail entity and view the properties. Change
the EntityKey property to true . This marks the ResumeId property as the entity's key. The
completed model is shown in Figure 13-13 .
Figure 13-13. The completed model with the Body property moved to the new ResumeDetail entity
The code in Listing 13-22 demonstrates how to use the ResumeDetail entity.
Listing 13-22. Using the ResumeDetail Entity to Lazy Load the Expensive Body Property
using (var context = new EFRecipesEntities())
{
var r1 = new Resume {Title = "C# Developer", Name = "Sally Jones"};
r1.ResumeDetail = new ResumeDetail {Body = "...very long resume goes here..."};
context.Resumes.Add(r1);
context.SaveChanges();
}
Search WWH ::




Custom Search