forked from JSONAPIdotNET/JSONAPI.NET
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPascalizedControllerSelector.cs
More file actions
24 lines (22 loc) · 767 Bytes
/
PascalizedControllerSelector.cs
File metadata and controls
24 lines (22 loc) · 767 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
using System.Net.Http;
using System.Web.Http;
using System.Web.Http.Dispatcher;
using JSONAPI.Extensions;
namespace JSONAPI.Http
{
/// <summary>
/// Chooses a controller based on the pascal-case version of the default controller name
/// </summary>
public class PascalizedControllerSelector : DefaultHttpControllerSelector
{
/// <param name="configuration">The configuration to use</param>
public PascalizedControllerSelector(HttpConfiguration configuration) : base(configuration)
{
}
public override string GetControllerName(HttpRequestMessage request)
{
var baseControllerName = base.GetControllerName(request);
return baseControllerName.Pascalize();
}
}
}