Skip to content

Commit 65189e5

Browse files
committed
Wilson GA Update
1 parent 362f438 commit 65189e5

File tree

67 files changed

+15877
-11148
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+15877
-11148
lines changed

TodoListService-ManualJwt/Areas/HelpPage/ApiDescriptionExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public static string GetFriendlyId(this ApiDescription description)
3131
localPath.Replace("/", "-").Replace("{", String.Empty).Replace("}", String.Empty));
3232
if (queryKeyString != null)
3333
{
34-
friendlyPath.AppendFormat("_{0}", queryKeyString);
34+
friendlyPath.AppendFormat("_{0}", queryKeyString.Replace('.', '-'));
3535
}
3636
return friendlyPath.ToString();
3737
}

TodoListService-ManualJwt/Areas/HelpPage/App_Start/HelpPageConfig.cs

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,20 @@
1+
// Uncomment the following to provide samples for PageResult<T>. Must also add the Microsoft.AspNet.WebApi.OData
2+
// package to your project.
3+
////#define Handle_PageResultOfT
4+
15
using System;
6+
using System.Collections;
27
using System.Collections.Generic;
8+
using System.Diagnostics;
9+
using System.Diagnostics.CodeAnalysis;
10+
using System.Linq;
311
using System.Net.Http.Headers;
12+
using System.Reflection;
413
using System.Web;
514
using System.Web.Http;
15+
#if Handle_PageResultOfT
16+
using System.Web.Http.OData;
17+
#endif
618

719
namespace TodoListService_ManualJwt.Areas.HelpPage
820
{
@@ -13,6 +25,12 @@ namespace TodoListService_ManualJwt.Areas.HelpPage
1325
/// </summary>
1426
public static class HelpPageConfig
1527
{
28+
[SuppressMessage("Microsoft.Globalization", "CA1303:Do not pass literals as localized parameters",
29+
MessageId = "TodoListService_ManualJwt.Areas.HelpPage.TextSample.#ctor(System.String)",
30+
Justification = "End users may choose to merge this string with existing localized resources.")]
31+
[SuppressMessage("Microsoft.Naming", "CA2204:Literals should be spelled correctly",
32+
MessageId = "bsonspec",
33+
Justification = "Part of a URI.")]
1634
public static void Register(HttpConfiguration config)
1735
{
1836
//// Uncomment the following to use the documentation from XML documentation file.
@@ -27,6 +45,20 @@ public static void Register(HttpConfiguration config)
2745
// {typeof(IEnumerable<string>), new string[]{"sample 1", "sample 2"}}
2846
//});
2947

48+
// Extend the following to provide factories for types not handled automatically (those lacking parameterless
49+
// constructors) or for which you prefer to use non-default property values. Line below provides a fallback
50+
// since automatic handling will fail and GeneratePageResult handles only a single type.
51+
#if Handle_PageResultOfT
52+
config.GetHelpPageSampleGenerator().SampleObjectFactories.Add(GeneratePageResult);
53+
#endif
54+
55+
// Extend the following to use a preset object directly as the sample for all actions that support a media
56+
// type, regardless of the body parameter or return type. The lines below avoid display of binary content.
57+
// The BsonMediaTypeFormatter (if available) is not used to serialize the TextSample object.
58+
config.SetSampleForMediaType(
59+
new TextSample("Binary JSON content. See http://bsonspec.org for details."),
60+
new MediaTypeHeaderValue("application/bson"));
61+
3062
//// Uncomment the following to use "[0]=foo&[1]=bar" directly as the sample for all actions that support form URL encoded format
3163
//// and have IEnumerable<string> as the body parameter or return type.
3264
//config.SetSampleForType("[0]=foo&[1]=bar", new MediaTypeHeaderValue("application/x-www-form-urlencoded"), typeof(IEnumerable<string>));
@@ -47,5 +79,35 @@ public static void Register(HttpConfiguration config)
4779
//// The sample will be generated as if the controller named "Values" and action named "Post" were returning a string.
4880
//config.SetActualResponseType(typeof(string), "Values", "Post");
4981
}
82+
83+
#if Handle_PageResultOfT
84+
private static object GeneratePageResult(HelpPageSampleGenerator sampleGenerator, Type type)
85+
{
86+
if (type.IsGenericType)
87+
{
88+
Type openGenericType = type.GetGenericTypeDefinition();
89+
if (openGenericType == typeof(PageResult<>))
90+
{
91+
// Get the T in PageResult<T>
92+
Type[] typeParameters = type.GetGenericArguments();
93+
Debug.Assert(typeParameters.Length == 1);
94+
95+
// Create an enumeration to pass as the first parameter to the PageResult<T> constuctor
96+
Type itemsType = typeof(List<>).MakeGenericType(typeParameters);
97+
object items = sampleGenerator.GetSampleObject(itemsType);
98+
99+
// Fill in the other information needed to invoke the PageResult<T> constuctor
100+
Type[] parameterTypes = new Type[] { itemsType, typeof(Uri), typeof(long?), };
101+
object[] parameters = new object[] { items, null, (long)ObjectGenerator.DefaultCollectionSize, };
102+
103+
// Call PageResult(IEnumerable<T> items, Uri nextPageLink, long? count) constructor
104+
ConstructorInfo constructor = type.GetConstructor(parameterTypes);
105+
return constructor.Invoke(parameters);
106+
}
107+
}
108+
109+
return null;
110+
}
111+
#endif
50112
}
51113
}

TodoListService-ManualJwt/Areas/HelpPage/Controllers/HelpController.cs

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using System;
22
using System.Web.Http;
33
using System.Web.Mvc;
4+
using TodoListService_ManualJwt.Areas.HelpPage.ModelDescriptions;
45
using TodoListService_ManualJwt.Areas.HelpPage.Models;
56

67
namespace TodoListService_ManualJwt.Areas.HelpPage.Controllers
@@ -10,6 +11,8 @@ namespace TodoListService_ManualJwt.Areas.HelpPage.Controllers
1011
/// </summary>
1112
public class HelpController : Controller
1213
{
14+
private const string ErrorViewName = "Error";
15+
1316
public HelpController()
1417
: this(GlobalConfiguration.Configuration)
1518
{
@@ -39,7 +42,22 @@ public ActionResult Api(string apiId)
3942
}
4043
}
4144

42-
return View("Error");
45+
return View(ErrorViewName);
46+
}
47+
48+
public ActionResult ResourceModel(string modelName)
49+
{
50+
if (!String.IsNullOrEmpty(modelName))
51+
{
52+
ModelDescriptionGenerator modelDescriptionGenerator = Configuration.GetModelDescriptionGenerator();
53+
ModelDescription modelDescription;
54+
if (modelDescriptionGenerator.GeneratedModels.TryGetValue(modelName, out modelDescription))
55+
{
56+
return View(modelDescription);
57+
}
58+
}
59+
60+
return View(ErrorViewName);
4361
}
4462
}
4563
}
Lines changed: 64 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,24 @@
1-
pre.wrapped {
1+
.help-page h1,
2+
.help-page .h1,
3+
.help-page h2,
4+
.help-page .h2,
5+
.help-page h3,
6+
.help-page .h3,
7+
#body.help-page,
8+
.help-page-table th,
9+
.help-page-table pre,
10+
.help-page-table p {
11+
font-family: "Segoe UI Light", Frutiger, "Frutiger Linotype", "Dejavu Sans", "Helvetica Neue", Arial, sans-serif;
12+
}
13+
14+
.help-page pre.wrapped {
215
white-space: -moz-pre-wrap;
316
white-space: -pre-wrap;
417
white-space: -o-pre-wrap;
518
white-space: pre-wrap;
619
}
720

8-
.warning-message-container {
21+
.help-page .warning-message-container {
922
margin-top: 20px;
1023
padding: 0 10px;
1124
color: #525252;
@@ -18,23 +31,24 @@ pre.wrapped {
1831
border-collapse: collapse;
1932
text-align: left;
2033
margin: 0px 0px 20px 0px;
21-
border-top: 2px solid #D4D4D4;
34+
border-top: 1px solid #D4D4D4;
2235
}
2336

2437
.help-page-table th {
2538
text-align: left;
2639
font-weight: bold;
27-
border-bottom: 2px solid #D4D4D4;
28-
padding: 8px 6px 8px 6px;
40+
border-bottom: 1px solid #D4D4D4;
41+
padding: 5px 6px 5px 6px;
2942
}
3043

3144
.help-page-table td {
32-
border-bottom: 2px solid #D4D4D4;
33-
padding: 15px 8px 15px 8px;
45+
border-bottom: 1px solid #D4D4D4;
46+
padding: 10px 8px 10px 8px;
3447
vertical-align: top;
3548
}
3649

37-
.help-page-table pre, .help-page-table p {
50+
.help-page-table pre,
51+
.help-page-table p {
3852
margin: 0px;
3953
padding: 0px;
4054
font-family: inherit;
@@ -45,21 +59,21 @@ pre.wrapped {
4559
background-color: #F3F3F3;
4660
}
4761

48-
a:hover {
62+
.help-page a:hover {
4963
background-color: transparent;
5064
}
5165

52-
.sample-header {
66+
.help-page .sample-header {
5367
border: 2px solid #D4D4D4;
54-
background: #76B8DB;
68+
background: #00497E;
5569
color: #FFFFFF;
5670
padding: 8px 15px;
5771
border-bottom: none;
5872
display: inline-block;
5973
margin: 10px 0px 0px 0px;
6074
}
6175

62-
.sample-content {
76+
.help-page .sample-content {
6377
display: block;
6478
border-width: 0;
6579
padding: 15px 20px;
@@ -68,22 +82,53 @@ a:hover {
6882
margin: 0px 0px 10px 0px;
6983
}
7084

71-
.api-name {
85+
.help-page .api-name {
7286
width: 40%;
7387
}
7488

75-
.api-documentation {
89+
.help-page .api-documentation {
7690
width: 60%;
7791
}
7892

79-
.parameter-name {
93+
.help-page .parameter-name {
8094
width: 20%;
8195
}
8296

83-
.parameter-documentation {
84-
width: 50%;
97+
.help-page .parameter-documentation {
98+
width: 40%;
99+
}
100+
101+
.help-page .parameter-type {
102+
width: 20%;
103+
}
104+
105+
.help-page .parameter-annotations {
106+
width: 20%;
107+
}
108+
109+
.help-page h1,
110+
.help-page .h1 {
111+
font-size: 36px;
112+
line-height: normal;
113+
}
114+
115+
.help-page h2,
116+
.help-page .h2 {
117+
font-size: 24px;
118+
}
119+
120+
.help-page h3,
121+
.help-page .h3 {
122+
font-size: 20px;
123+
}
124+
125+
#body.help-page {
126+
font-size: 14px;
127+
line-height: 143%;
128+
color: #333;
85129
}
86130

87-
.parameter-source {
88-
width: 30%;
131+
.help-page a {
132+
color: #0000EE;
133+
text-decoration: none;
89134
}

0 commit comments

Comments
 (0)