Skip to content
This repository was archived by the owner on Nov 1, 2023. It is now read-only.

Commit

Permalink
Update demo to ASP.NET WebApi 5.2.3, refix #21
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanprodan committed Feb 25, 2015
1 parent f07343f commit a31703d
Show file tree
Hide file tree
Showing 38 changed files with 6,385 additions and 6,201 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public static string GetFriendlyId(this ApiDescription description)
localPath.Replace("/", "-").Replace("{", String.Empty).Replace("}", String.Empty));
if (queryKeyString != null)
{
friendlyPath.AppendFormat("_{0}", queryKeyString);
friendlyPath.AppendFormat("_{0}", queryKeyString.Replace('.', '-'));
}
return friendlyPath.ToString();
}
Expand Down
5 changes: 3 additions & 2 deletions WebApiThrottle.Demo/Areas/HelpPage/HelpPage.css
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@

.help-page .sample-header {
border: 2px solid #D4D4D4;
background: #76B8DB;
background: #00497E;
color: #FFFFFF;
padding: 8px 15px;
border-bottom: none;
Expand Down Expand Up @@ -109,6 +109,7 @@
.help-page h1,
.help-page .h1 {
font-size: 36px;
line-height: normal;
}

.help-page h2,
Expand All @@ -128,6 +129,6 @@
}

.help-page a {
color: #00abec;
color: #0000EE;
text-decoration: none;
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
Expand Down Expand Up @@ -268,7 +269,28 @@ private static void GenerateUriParameters(HelpPageApiModel apiModel, ModelDescri
complexTypeDescription = typeDescription as ComplexTypeModelDescription;
}

if (complexTypeDescription != null)
// Example:
// [TypeConverter(typeof(PointConverter))]
// public class Point
// {
// public Point(int x, int y)
// {
// X = x;
// Y = y;
// }
// public int X { get; set; }
// public int Y { get; set; }
// }
// Class Point is bindable with a TypeConverter, so Point will be added to UriParameters collection.
//
// public class Point
// {
// public int X { get; set; }
// public int Y { get; set; }
// }
// Regular complex class Point will have properties X and Y added to UriParameters collection.
if (complexTypeDescription != null
&& !IsBindableWithTypeConverter(parameterType))
{
foreach (ParameterDescription uriParameter in complexTypeDescription.Properties)
{
Expand Down Expand Up @@ -305,6 +327,16 @@ private static void GenerateUriParameters(HelpPageApiModel apiModel, ModelDescri
}
}

private static bool IsBindableWithTypeConverter(Type parameterType)
{
if (parameterType == null)
{
return false;
}

return TypeDescriptor.GetConverter(parameterType).CanConvertFrom(typeof(string));
}

private static ParameterDescription AddParameterDescription(HelpPageApiModel apiModel,
ApiParameterDescription apiParameter, ModelDescription typeDescription)
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!DOCTYPE html>
<html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width" />
Expand Down
2 changes: 1 addition & 1 deletion WebApiThrottle.Demo/Areas/HelpPage/Views/Web.config
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
</configSections>

<system.web.webPages.razor>
<host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=5.1.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<pages pageBaseType="System.Web.Mvc.WebViewPage">
<namespaces>
<add namespace="System.Web.Mvc" />
Expand Down
Loading

0 comments on commit a31703d

Please sign in to comment.