I'm working with MVC 4 and I have this simple dummy ValueProvider:
class DummyValueProviderFactory : ValueProviderFactory
{
public override IValueProvider GetValueProvider(ControllerContext controllerContext)
{
return new DummyValueProvider();
}
private class DummyValueProvider : IValueProvider
{
public DummyValueProvider()
{
}
public bool ContainsPrefix(string prefix)
{
return true;
}
public ValueProviderResult GetValue(string key)
{
return null;
}
}
}
And my problem resides when I try to register it's factory in the Web API:
config.Services.Add(typeof(ValueProviderFactory), new DummyValueProviderFactory());
It compiles OK, but when the server starts, I get an ArgumentException telling me The service type ValueProviderFactory is not supported
.
I've read this tutorial and this other one and both are telling me it should work fine. What am I doing wrong?