concept complex business logic in category entity framework

appears as: complex business logic, complex business logic
Entity Framework Core in Action, SE

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

The advantage of explicit loading is that you can load a relationship of an entity class later. I’ve found this useful when using a library that loads only the primary entity class and you need one of its relationships. Explicit loading can also be useful if you need that related data only in some circumstances. You might also find explicit loading useful in complex business logic, because you can leave the job of loading the specific relationships to the parts of the business logic that need it.

I start with the complex business logic because that will introduce you to a powerful approach to handling business coming from Eric Evan’s Domain-Driven Design book that I quote from above. But first look at a complex business feature I want to implement in my Book App.

Figure 4.2 The projects inside our Book App, with two new projects for handling complex business logic. The “Pure business logic” project contains the isolated business logic which thinks it is just working on an in-memory set of classes. The “Business database access” project provides an interface that the pure business logic can use to access the database. The ServiceLayer’s job is to adapt the data from the ASP.NET Core application to send to the pure business logic in the form it wants it in and calls the final SaveChanges to save if the business logic doesn’t report any errors.