Issue with InvalidateCacheOutput from another controller
Having this action filter
[InvalidateCacheOutput("Get", typeof(WeatherForecastController))].
On another controller not working because of constructor overloads
public InvalidateCacheOutputAttribute(string methodName, Type cacheKeyGeneratorType = default(Type))
: this(methodName, null, cacheKeyGeneratorType)
{
}
public InvalidateCacheOutputAttribute(
string methodName,
Type controllerType,
Type cacheKeyGeneratorType = default(Type)
)
{
this.controller = controllerType != null ? controllerType.FullName : null;
this.methodName = methodName;
this.cacheKeyGeneratorType = cacheKeyGeneratorType;
}
The only way it works is having
[InvalidateCacheOutput("Get", typeof(WeatherForecastController), typeof(DefaultCacheKeyGenerator))]
Can this be improved ? So we don't have to specify cachekey
ALso, you could pass null. Any suggestions?
@Iamcerba I'd recommend instead of constructor chaining having two different constructors
public InvalidateCacheOutputAttribute(string methodName, Type cacheKeyGeneratorType = default(Type)){}
and
public InvalidateCacheOutputAttribute(Type controllerType, string methodName, Type cacheKeyGeneratorType = default(Type))
What do you think?
Agree, will be a part of the 2.0 release as soon as it may be breaking.