Chapter 8. Object Lifetime

Menu

  • Managing Dependency Lifetime
  • Disposable Dependencies
  • Singleton
  • Transient
  • Per Graph
  • Web Request Context
  • Pooled

The passing of time has a profound effect on most foods and drinks, but the consequences vary. Personally, I find 12-month-old Gruyère much more interesting than 6-month-old Gruyère, but I prefer my asparagus much fresher than either of those. In many cases, it’s easy to assess the proper age of an item; but in certain cases, doing so becomes very complex. This is most notable when it comes to wine (see figure 8.1).

Figure 8.1. Wine, cheese, and asparagus. Although the combination may be a bit off, their age greatly affects their overall qualities.

Wines tend to get better with age—until they suddenly ...

Get Dependency Injection in .NET now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.