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]publicclassBasicSample{publicBasicSample(IMemoryCachememoryCache){MemoryCache=memoryCache;}protectedIMemoryCacheMemoryCache;// ...}
Instead of only looking for a property that implements
IMemoryCache/IDistributedCachewe shall also allow fields.In case both a property and a field of type
IMemoryCache/IDistributedCacheis found in the class, the property will implicitly take precedence.Code sample: