linux-packaging-mono/mcs/class/System.Web.Mvc3/Mvc/FormValueProviderFactory.cs
Jo Shields a575963da9 Imported Upstream version 3.6.0
Former-commit-id: da6be194a6b1221998fc28233f2503bd61dd9d14
2014-08-13 10:39:27 +01:00

29 lines
1011 B
C#

namespace System.Web.Mvc {
using System;
using System.Collections.Specialized;
using System.Web.Helpers;
public sealed class FormValueProviderFactory : ValueProviderFactory {
private readonly UnvalidatedRequestValuesAccessor _unvalidatedValuesAccessor;
public FormValueProviderFactory()
: this(null) {
}
// For unit testing
internal FormValueProviderFactory(UnvalidatedRequestValuesAccessor unvalidatedValuesAccessor) {
_unvalidatedValuesAccessor = unvalidatedValuesAccessor ?? (cc => new UnvalidatedRequestValuesWrapper(cc.HttpContext.Request.Unvalidated()));
}
public override IValueProvider GetValueProvider(ControllerContext controllerContext) {
if (controllerContext == null) {
throw new ArgumentNullException("controllerContext");
}
return new FormValueProvider(controllerContext, _unvalidatedValuesAccessor(controllerContext));
}
}
}