concept call in category dependency injection

appears as: call, calls, calls
Dependency Injection

This is an excerpt from Manning's book Dependency Injection.

Inside a CustomerServices component, the Customer's RedeemVoucher method can be called while passing the IVoucherRedemptionService Dependency with the call, as shown next.

This approach can be generalized, providing you with the ability to Intercept a call from a consumer to a service. This is what we’ll cover in this chapter.

The simplest Decorator implementation is one that delegates the call to the decorated object without doing anything at all:

public class SimpleDecorator : IGreeter    #1  
{
    private readonly IGreeter decoratee;    #1  

    public SimpleDecorator(IGreeter decoratee)
    {
        this.decoratee = decoratee;
    }

    public string Greet(string name)
    {
        return this.decoratee.Greet(name);    #2  
    }
}

#1   A Decorator wraps a component of the same Abstraction as it implements.
#2   The call to Greet is passed without any changes to the decorated component; its return value is directly returned as well.

Figure 9.4 shows the relationship between IGreeter, FormalGreeter, and SimpleDecorator. Because SimpleDecorator doesn’t do anything except forward the call, it’s pretty useless. Instead, a Decorator can choose to modify the input before delegating the call.