...

/

Lazy-Load a Heavy Service Only When First Used

Lazy-Load a Heavy Service Only When First Used

Delay the creation of a resource-intensive object until its first actual use.

We'll cover the following...

Problem statement

Your system utilizes a heavy-duty data service, DataService, which performs an expensive initialization when it is constructed. This service is always created on startup—even if no code ends up using it—wasting time and memory. ...