Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Matching parameter by name when binding ODataQueryOptions. #1173

Merged
merged 1 commit into from
Dec 21, 2017

Conversation

robward-ms
Copy link
Contributor

Issues

This pull request makes progress on issues #975, #939, #772, #628, #229.
This pull request fixes #1170, #1171, #1172

Description

Matching parameter by name when binding ODataQueryOptions.
Skip OData output formatting for non-OData routes.
Improved routing action selection.
Add EnableDependencyInjection() for non-OData routes.

Checklist (Uncheck if it is not completed)

  • Test cases added
  • [x ] Build and test with one-click build and test script passed

Additional work necessary

Refactor Batching for AspNetCore.
Port Unit Tests to NetCore
Port E2E Tests to NetCore & Xunit 2.0

? configuration.GetODataRootContainer(routeName)
: configuration.GetNonODataRootContainer();

IServiceProvider rootContainer = configuration.GetODataRootContainer(routeName);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: the indentation is off by one space from the other lines.

{
// For HTTP routes, use the default request services.
rootContainer = request.HttpContext.RequestServices;
throw Error.ArgumentNull("routeName");
Copy link
Contributor

@AlanWong-MS AlanWong-MS Dec 21, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're throwing argument null exception for "routeName" when perRouteContainer is null? Should this one be an exception for perRouteContainer and a separate if-statement check above for routeName?

throw Error.ArgumentNull("routeName");
}
IServiceProvider rootContainer = perRouteContainer.GetODataRootContainer(routeName);
if (perRouteContainer == null)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Duplicate perRouteContainer check here. I think you meant rootContainer?

perRouteContainer.CreateODataRootContainer(null, ConfigureDefaultServices(builder, configureAction));
}


Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extra empty line.

IPerRouteContainer perRouteContainer = builder.ServiceProvider.GetRequiredService<IPerRouteContainer>();
if (perRouteContainer == null)
{
throw Error.ArgumentNull("routeName");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same question regarding the use of "routeName" as above.

// determination.
if (!contentTypeSpecified && matchedMappings != null && matchedMappings.Any())
// Now pick the best content type. If a media mapping was found, use that and override the
// value specified by the controller, if any. Otherwiser, let the base class decide.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo: Otherwiser -> Otherwise

/// </summary>
/// <param name="configuration">The server configuration.</param>
/// <param name="rootContainer">The root container.</param>
public static void SetNonODataRootContainer(this HttpConfiguration configuration,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be internal, not public.

Skip OData output formatting for non-OData routes.
Improved routing action selection.
Add EnableDependencyInjection() for non-OData routes.
@robward-ms robward-ms merged commit 46dc2c0 into OData:feature/netcore Dec 21, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants