Merge pull request #249 from pcc/xgetinputfocus
[mono.git] / mcs / class / System.Web.Mvc3 / Mvc / ChildActionValueProvider.cs
1 namespace System.Web.Mvc {
2     using System;
3     using System.Globalization;
4
5     public sealed class ChildActionValueProvider : DictionaryValueProvider<object> {
6
7         public ChildActionValueProvider(ControllerContext controllerContext)
8             : base(controllerContext.RouteData.Values, CultureInfo.InvariantCulture) {
9         }
10
11         private static string _childActionValuesKey = Guid.NewGuid().ToString();
12
13         internal static string ChildActionValuesKey {
14             get {
15                 return _childActionValuesKey;
16             }
17         }
18
19         public override ValueProviderResult GetValue(string key) {
20             if (key == null) {
21                 throw new ArgumentNullException("key");
22             }
23
24             ValueProviderResult explicitValues = base.GetValue(ChildActionValuesKey);
25             if (explicitValues != null) {
26                 DictionaryValueProvider<object> rawExplicitValues = explicitValues.RawValue as DictionaryValueProvider<object>;
27                 if (rawExplicitValues != null) {
28                     return rawExplicitValues.GetValue(key);
29                 }
30             }
31
32             return null;
33         }
34     }
35 }