Value holder

Value holder The roles in this pattern are: ValueHolder- uses the IValueLoader through a Strategy Pattern to load the value when it is first accessed IValueLoader Factory Good news. The ValueHolder, and the IValueLoader are reusable, so you don't have to create these for every different object that you're going to load lazily. Value holder vs Lazy<T> type … Continue reading Value holder

Virtual proxy

Virtual proxy Proxy looks like the real object but does not have fully loaded state. When a request to one of its properties is made, it fetches it from the underlying object or data store. Client is the code that is using your object. It refers to an interface that both the real object and the proxy … Continue reading Virtual proxy

Lazy initialization and Lazy class

Lazy initialization Lazy Initialization is the simplest approach to lazy loading. The property check if its backing field was already initialized. If not, it initializes it and if it was- returns it. Typically the property just checks for null value. If null s a legal value - that can be for example obtained from the database … Continue reading Lazy initialization and Lazy class

Lazy loading

The intent of lazy loading If you're lazy about doing things you'll win when it turns out you don't need to do them at all. Martin Fowler The intent of this approach is to increase application performance by reducing the amount of work it has to do in situations when this work is not necessary. … Continue reading Lazy loading