MethodCache.Fody icon indicating copy to clipboard operation
MethodCache.Fody copied to clipboard

Support fields for cache retrieval

Open pergerch opened this issue 5 years ago • 0 comments

Instead of only looking for a property that implements IMemoryCache / IDistributedCache we shall also allow fields.

In case both a property and a field of type IMemoryCache / IDistributedCache is found in the class, the property will implicitly take precedence.

Code sample:

[Cache]
public class BasicSample
{
    public BasicSample(IMemoryCache memoryCache)
    {
        MemoryCache = memoryCache;
    }

    protected IMemoryCache MemoryCache;

    // ...
}

pergerch avatar Nov 06 '20 13:11 pergerch