concept change in category entity framework

appears as: The chges, chges, chges, chge, chge, The chge, change, The chges, A chge
Entity Framework Core in Action

This is an excerpt from Manning's book Entity Framework Core in Action.

All books need to be finished, and this book went into the print process phase before EF Core 2.1 was released. Thankfully, version 2.1 is a minor update, so it doesn’t change the code in this book that much, but it does add new features and improvements. The changes are welcome, especially some of the new features; hence, I added this appendix and various EF Core 2.1 notes to the book before it went to print.

Listing 5.6 The ChangePubDate action method in AdminController
public IActionResult ChangePubDate    #1  
    (int id,    #2  
    [FromServices]IChangePubDateService service)    #3  
{
    var dto = service.GetOriginal(id);    #4  
    return View(dto);    #5  
}

#1   The action called if the user clicks the Admin > Change Pub Date link
#2   Receives the primary key of the book that the user wants to change
#3   ASP.NET DI injects the ChangePubDateService instance
#4   Uses the service to set up a DTO to show the user
#5   Shows the page that allows the user to edit the publication date
  • ChangeTracker—This provides access to EF Core’s change tracking code. You used this in chapter 3 to run data validation before SaveChanges, and you’ll spend quite a bit of time looking at how this works in this chapter, starting with the next section.

    Quite a few of DbContext’s methods work with the ChangeTracker, and you’ll learn about those in this chapter.

    • Database—This property provides access to three main groups of features:
    • Transaction control, covered in section 4.6.2
    • Database creation/migration, covered in chapter 11
    • Raw SQL commands, covered in section 9.5
  • Figure 11.1 Various databases can be used in an application’s development, all of which will need database schema changes applied to them. The terms development, testing, pre-production, and production refer to different parts of the development, testing, and deployment of an application and any associated database schema changes.

    11_01.png
    Entity Framework 4 in Action

    This is an excerpt from Manning's book Entity Framework 4 in Action.

    The heart of O/RM is the mapping—the mapping technique is what binds the object and relational worlds. By mapping, you express how a class and its properties are related to one or more tables in the database. This information is used by the O/RM tool’s engine to dynamically build SQL code that retrieves data and transforms it into objects. Similarly, by tracking changes to objects’ properties, it can use mapping data to send updates back to the database. The mapping information is generally expressed as an XML file. As an alternative, some O/RM tools use attributes on the classes and their properties to maintain mapping data.

    An O/RM tool is a complex piece of software that saves the developer from the burden of managing the interaction with the database. It handles the collision between object and relational worlds, it transforms query data into objects, it tracks updates to objects to reflect changes in the database, and a lot more. The idea of coding these features manually is absurd when you have a tool that does it for you.

    The change from the Unchanged to the Modified state is the only one that’s automatically handled by the context. All other changes must be made explicitly using proper methods:

    Figure 6.2. The code injected by the proxy notifies the state manager about changes in properties.