Skip to content

3.1.0

Compare
Choose a tag to compare
@commonsensesoftware commonsensesoftware released this 22 Dec 19:51

This is a minor release that primarily supports the Endpoint Routing feature introduced in ASP.NET Core 2.2.

This release will require you to upgrade to ASP.NET Core 2.2 if you haven't already

Features

The following are new features since 3.0.0:

ASP.NET Web API

  • Updated sample projects to:
    • Use OWIN self-hosting (much faster and easier to maintain than IIS Express)
    • Use the SDK style project format
    • Use the most current C# language features

ASP.NET Core

  • Support Endpoint Routing (#413)
    • All sample projects now use Endpoint Routing by default
    • The legacy routing system via IRouter is still supported
  • Support default parameters values in the API Explorer (#414)
  • Added IApiControllerSpecification to identify API controllers
    • The built-in ApiBehaviorSpecification matches controllers decorated with [ApiController]
interface IApiControllerSpecification
{
    bool IsSatisfiedBy( ControllerModel controller );
}

ASP.NET Core with OData

  • Added ODataControllerSpecification to identify OData controllers as API controllers

Fixes

The following are fixes and patches since 3.0.0:

ASP.NET Web API with OData

  • Fixed exploring query options for POST when the controller action is not an EDM action

ASP.NET Core

  • Fixed possible NullReferenceException with Endpoint Routing in ApiVersionRouteConstraint

ASP.NET Core with OData

  • Fixed exploring query options for POST when the controller action is not an EDM action
  • Fixed a scenario where ODataAttributeRouteInfo was not generated for some actions

Breaking Changes

The following a behavioral breaking changes.

ASP.NET Core

  • ApiVersioningOptions.UseApiBehavior is now true by default
    • This might result in excluding your API controllers if [ApiController] has not been applied
    • If your API controllers use convention-based routing, they will definitely be excluded because [ApiController] cannot be applied
    • Resolutions:
      1. Set ApiVersioningOptions.UseApiBehavior = false
      2. Decorated your controllers with [ApiController]
      3. Create a custom IApiControllerSpecification for your controllers and register it with services.TryAddEnumerable(ServiceDescriptor.Transient<IApiControllerSpecification, MyApiControllerSpec>());
public class MyApiControllerSpec : IApiControllerSpecification
{
    // consider all controllers that inherit from Controller to be a UI controller
    readonly Type UIControllerType = typeof( Controller ).GetTypeInfo();

    public bool IsSatisfiedBy( ControllerModel controller ) =>
        !UIControllerType.IsAssignableFrom( controller.ControllerType )
}

Figure 1: Sample custom API specification

Known Issues

The following are known issues in this release:

ASP.NET Core with OData

  • Endpoint Routing is not supported
    • OData does not intrinsically support Endpoint Routing (OData/WebApi#1707)
    • Disable Endpoint Routing with services.AddMvc( options => options.EnableEndpointRouting = false );