Table of Contents

Class DnnAppApiControllerSelector

Namespace
ToSic.Sxc.Dnn.WebApi.Custom.Sys
Assembly
ToSic.Sxc.Dnn.WebApi.dll

This is a .net Framework controller selector to handle dynamically compiled controllers inside 2sxc apps.

[InternalApi_DoNotUse_MayChangeWithoutNotice("only made public for docs")]
public class DnnAppApiControllerSelector
Inheritance
object
DnnAppApiControllerSelector

Remarks

It will be registered in the ServicesContainer to override the previous selector. It will

  1. check if it's responsible (based on url)
  2. and if yes, hand off to DnnAppApiControllerService to compile / run the app-specific api controllers
  3. otherwise hand processing back to next api controller up-stream

Constructors

DnnAppApiControllerSelector(HttpConfiguration)

This is a .net Framework controller selector to handle dynamically compiled controllers inside 2sxc apps.

public DnnAppApiControllerSelector(HttpConfiguration configuration)

Parameters

configuration HttpConfiguration

Remarks

It will be registered in the ServicesContainer to override the previous selector. It will

  1. check if it's responsible (based on url)
  2. and if yes, hand off to DnnAppApiControllerService to compile / run the app-specific api controllers
  3. otherwise hand processing back to next api controller up-stream

Methods

GetControllerMapping()

Returns a map, keyed by controller string, of all System.Web.Http.Controllers.HttpControllerDescriptor that the selector can select. This is primarily called by System.Web.Http.Description.IApiExplorer to discover all the possible controllers in the system.

public IDictionary<string, HttpControllerDescriptor> GetControllerMapping()

Returns

IDictionary<string, HttpControllerDescriptor>

A map of all System.Web.Http.Controllers.HttpControllerDescriptor that the selector can select, or null if the selector does not have a well-defined mapping of System.Web.Http.Controllers.HttpControllerDescriptor.

Register()

Registration in the services so it can handle the requests.

public static void Register()

Remarks

Will remember the previous selector and return that if it doesn't match.

SelectController(HttpRequestMessage)

Selects a System.Web.Http.Controllers.HttpControllerDescriptor for the given System.Net.Http.HttpRequestMessage.

public HttpControllerDescriptor SelectController(HttpRequestMessage request)

Parameters

request HttpRequestMessage

The request message.

Returns

HttpControllerDescriptor

An System.Web.Http.Controllers.HttpControllerDescriptor instance.