forked from aspnet/AspNetWebStack
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathChildActionValueProvider.cs
More file actions
42 lines (35 loc) · 1.33 KB
/
Copy pathChildActionValueProvider.cs
File metadata and controls
42 lines (35 loc) · 1.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Globalization;
namespace System.Web.Mvc
{
public sealed class ChildActionValueProvider : DictionaryValueProvider<object>
{
private static string _childActionValuesKey = Guid.NewGuid().ToString();
public ChildActionValueProvider(ControllerContext controllerContext)
: base(controllerContext.RouteData.Values, CultureInfo.InvariantCulture)
{
}
internal static string ChildActionValuesKey
{
get { return _childActionValuesKey; }
}
public override ValueProviderResult GetValue(string key)
{
if (key == null)
{
throw new ArgumentNullException("key");
}
ValueProviderResult explicitValues = base.GetValue(ChildActionValuesKey);
if (explicitValues != null)
{
DictionaryValueProvider<object> rawExplicitValues = explicitValues.RawValue as DictionaryValueProvider<object>;
if (rawExplicitValues != null)
{
return rawExplicitValues.GetValue(key);
}
}
return null;
}
}
}