Skip to content

Commit fe773ae

Browse files
committed
Code review fixes #2583
1 parent 885c439 commit fe773ae

5 files changed

Lines changed: 58 additions & 38 deletions

File tree

src/NuGetGallery.Operations/app.config

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,26 @@
22
<configuration>
33
<runtime>
44
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
5-
<dependentAssembly>
6-
<assemblyIdentity name="System.Spatial" publicKeyToken="31BF3856AD364E35" culture="neutral"/>
7-
<bindingRedirect oldVersion="0.0.0.0-5.6.5.0" newVersion="5.6.5.0"/>
8-
</dependentAssembly>
9-
<dependentAssembly>
10-
<assemblyIdentity name="System.Web.WebPages.Deployment" publicKeyToken="31BF3856AD364E35" culture="neutral"/>
11-
<bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0"/>
12-
</dependentAssembly>
13-
<dependentAssembly>
14-
<assemblyIdentity name="System.Net.Http.Primitives" publicKeyToken="B03F5F7F11D50A3A" culture="neutral"/>
15-
<bindingRedirect oldVersion="0.0.0.0-4.2.29.0" newVersion="4.2.29.0"/>
16-
</dependentAssembly>
17-
<dependentAssembly>
18-
<assemblyIdentity name="System.Web.Http" publicKeyToken="31BF3856AD364E35" culture="neutral"/>
19-
<bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="5.2.3.0"/>
20-
</dependentAssembly>
21-
<dependentAssembly>
22-
<assemblyIdentity name="System.Web.Razor" publicKeyToken="31BF3856AD364E35" culture="neutral"/>
23-
<bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0"/>
24-
</dependentAssembly>
5+
<dependentAssembly>
6+
<assemblyIdentity name="System.Spatial" publicKeyToken="31BF3856AD364E35" culture="neutral"/>
7+
<bindingRedirect oldVersion="0.0.0.0-5.6.5.0" newVersion="5.6.5.0"/>
8+
</dependentAssembly>
9+
<dependentAssembly>
10+
<assemblyIdentity name="System.Web.WebPages.Deployment" publicKeyToken="31BF3856AD364E35" culture="neutral"/>
11+
<bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0"/>
12+
</dependentAssembly>
13+
<dependentAssembly>
14+
<assemblyIdentity name="System.Net.Http.Primitives" publicKeyToken="B03F5F7F11D50A3A" culture="neutral"/>
15+
<bindingRedirect oldVersion="0.0.0.0-4.2.29.0" newVersion="4.2.29.0"/>
16+
</dependentAssembly>
17+
<dependentAssembly>
18+
<assemblyIdentity name="System.Web.Http" publicKeyToken="31BF3856AD364E35" culture="neutral"/>
19+
<bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="5.2.3.0"/>
20+
</dependentAssembly>
21+
<dependentAssembly>
22+
<assemblyIdentity name="System.Web.Razor" publicKeyToken="31BF3856AD364E35" culture="neutral"/>
23+
<bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0"/>
24+
</dependentAssembly>
2525
<dependentAssembly>
2626
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral"/>
2727
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0"/>
@@ -56,4 +56,4 @@
5656
</dependentAssembly>
5757
</assemblyBinding>
5858
</runtime>
59-
</configuration>
59+
</configuration>

src/NuGetGallery/App_Start/NuGetODataConfig.cs

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,20 +23,24 @@ public static void Register(HttpConfiguration config)
2323
new CustomSerializerProvider(provider => new NuGetEntityTypeSerializer(provider)),
2424
new DefaultODataDeserializerProvider());
2525

26-
// Disable json and atomsvc - if these are ever needed, please reorder them so they are at the end of the collection. This will save you a few hours of debugging.
27-
var reorderedFormatters = odataFormatters
28-
.Where(f => !f.SupportedMediaTypes.Any(m => m.MediaType == "application/atomsvc+xml" || m.MediaType.StartsWith("application/json", StringComparison.OrdinalIgnoreCase)))
26+
// Disable json and atomsvc - if these are ever needed, please reorder them
27+
// so they are at the end of the collection.
28+
// This will save you a few hours of debugging.
29+
var filteredFormatters = odataFormatters
30+
.Where(f => !f.SupportedMediaTypes.Any(m => m.MediaType == "application/atomsvc+xml"
31+
|| m.MediaType.StartsWith("application/json", StringComparison.OrdinalIgnoreCase)))
2932
.ToList();
3033

3134
// Disable indenting
32-
foreach (var mediaTypeFormatter in reorderedFormatters)
35+
foreach (var mediaTypeFormatter in filteredFormatters)
3336
{
3437
mediaTypeFormatter.MessageWriterSettings.Indent = false;
3538
}
3639

37-
// Register formatters as the one and only formatters. If ever Web API is enabled, make sure to update this to have JSON/XML support.
40+
// Register formatters as the one and only formatters.
41+
// If WebAPI is ever enabled, ensure to update this to have JSON/XML support.
3842
config.Formatters.Clear();
39-
config.Formatters.InsertRange(0, reorderedFormatters);
43+
config.Formatters.InsertRange(0, filteredFormatters);
4044

4145
// Register feeds
4246
NuGetODataV1FeedConfig.Register(config);

src/NuGetGallery/App_Start/NuGetODataV1FeedConfig.cs

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,18 @@ public static void Register(HttpConfiguration config)
3232
conventions.Insert(0, new CompositeKeyRoutingConvention());
3333

3434
// Translate all requests to use V2FeedController instead of PackagesController
35-
conventions = conventions.Select(c => new ControllerAliasingODataRoutingConvention(c, "Packages", "ODataV1Feed")).Cast<IODataRoutingConvention>().ToList();
35+
conventions =
36+
conventions.Select(c => new ControllerAliasingODataRoutingConvention(c, "Packages", "ODataV1Feed"))
37+
.Cast<IODataRoutingConvention>()
38+
.ToList();
3639

3740
// Add OData routes
38-
config.Routes.MapODataServiceRoute("api-v1-odata1", "api/v1/FeedService.svc", model, new CountODataPathHandler(), conventions, new DefaultODataBatchHandler(GlobalConfiguration.DefaultServer));
39-
config.Routes.MapODataServiceRoute("api-v1-odata2", "api/v1", model, new CountODataPathHandler(), conventions, new DefaultODataBatchHandler(GlobalConfiguration.DefaultServer));
40-
config.Routes.MapODataServiceRoute("api-v1-odata3", "v1/FeedService.svc", model, new CountODataPathHandler(), conventions, new DefaultODataBatchHandler(GlobalConfiguration.DefaultServer));
41+
config.Routes.MapODataServiceRoute("api-v1-odata1", "api/v1/FeedService.svc", model,
42+
new CountODataPathHandler(), conventions, new DefaultODataBatchHandler(GlobalConfiguration.DefaultServer));
43+
config.Routes.MapODataServiceRoute("api-v1-odata2", "api/v1", model,
44+
new CountODataPathHandler(), conventions, new DefaultODataBatchHandler(GlobalConfiguration.DefaultServer));
45+
config.Routes.MapODataServiceRoute("api-v1-odata3", "v1/FeedService.svc", model,
46+
new CountODataPathHandler(), conventions, new DefaultODataBatchHandler(GlobalConfiguration.DefaultServer));
4147
}
4248

4349
public static IEdmModel GetEdmModel()
@@ -65,7 +71,7 @@ public static IEdmModel GetEdmModel()
6571
var model = builder.GetEdmModel();
6672
model.SetEdmVersion(new Version(1, 0));
6773
model.SetEdmxVersion(new Version(1, 0));
68-
model.SetHasDefaultStream(model.FindDeclaredType(typeof(V1FeedPackage).FullName) as IEdmEntityType, hasStream: true);
74+
model.SetHasDefaultStream(model.FindDeclaredType(typeof(V1FeedPackage).FullName) as IEdmEntityType, true);
6975

7076
return model;
7177
}

src/NuGetGallery/App_Start/NuGetODataV2CuratedFeedConfig.cs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,16 @@ public static void Register(HttpConfiguration config)
3232
conventions.Insert(0, new CompositeKeyRoutingConvention());
3333

3434
// Translate all requests to use V2FeedController instead of PackagesController
35-
conventions = conventions.Select(c => new ControllerAliasingODataRoutingConvention(c, "Packages", "ODataV2CuratedFeed")).Cast<IODataRoutingConvention>().ToList();
35+
conventions =
36+
conventions.Select(
37+
c => new ControllerAliasingODataRoutingConvention(c, "Packages", "ODataV2CuratedFeed"))
38+
.Cast<IODataRoutingConvention>()
39+
.ToList();
3640

3741
// Add OData routes
38-
config.Routes.MapODataServiceRoute("api-v2curated-odata", "api/v2/curated-feeds/{curatedFeedName}", model, new CountODataPathHandler(), conventions, new DefaultODataBatchHandler(GlobalConfiguration.DefaultServer));
42+
config.Routes.MapODataServiceRoute("api-v2curated-odata", "api/v2/curated-feeds/{curatedFeedName}", model,
43+
new CountODataPathHandler(), conventions,
44+
new DefaultODataBatchHandler(GlobalConfiguration.DefaultServer));
3945
}
4046

4147
public static IEdmModel GetEdmModel()
@@ -64,7 +70,7 @@ public static IEdmModel GetEdmModel()
6470
var model = builder.GetEdmModel();
6571
model.SetEdmVersion(new Version(1, 0));
6672
model.SetEdmxVersion(new Version(1, 0));
67-
model.SetHasDefaultStream(model.FindDeclaredType(typeof(V2FeedPackage).FullName) as IEdmEntityType, hasStream: true);
73+
model.SetHasDefaultStream(model.FindDeclaredType(typeof(V2FeedPackage).FullName) as IEdmEntityType, true);
6874

6975
return model;
7076
}

src/NuGetGallery/App_Start/NuGetODataV2FeedConfig.cs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,14 @@ public static void Register(HttpConfiguration config)
3232
conventions.Insert(0, new CompositeKeyRoutingConvention());
3333

3434
// Translate all requests to use V2FeedController instead of PackagesController
35-
conventions = conventions.Select(c => new ControllerAliasingODataRoutingConvention(c, "Packages", "ODataV2Feed")).Cast<IODataRoutingConvention>().ToList();
35+
conventions =
36+
conventions.Select(c => new ControllerAliasingODataRoutingConvention(c, "Packages", "ODataV2Feed"))
37+
.Cast<IODataRoutingConvention>()
38+
.ToList();
3639

3740
// Add OData routes
38-
config.Routes.MapODataServiceRoute("api-v2-odata", "api/v2", model, new CountODataPathHandler(), conventions, new DefaultODataBatchHandler(GlobalConfiguration.DefaultServer));
41+
config.Routes.MapODataServiceRoute("api-v2-odata", "api/v2", model, new CountODataPathHandler(), conventions,
42+
new DefaultODataBatchHandler(GlobalConfiguration.DefaultServer));
3943
}
4044

4145
public static IEdmModel GetEdmModel()
@@ -73,7 +77,7 @@ public static IEdmModel GetEdmModel()
7377
var model = builder.GetEdmModel();
7478
model.SetEdmVersion(new Version(1, 0));
7579
model.SetEdmxVersion(new Version(1, 0));
76-
model.SetHasDefaultStream(model.FindDeclaredType(typeof(V2FeedPackage).FullName) as IEdmEntityType, hasStream: true);
80+
model.SetHasDefaultStream(model.FindDeclaredType(typeof(V2FeedPackage).FullName) as IEdmEntityType, true);
7781

7882
return model;
7983
}

0 commit comments

Comments
 (0)