Unosquare
    Show / Hide Table of Contents

    Class WebApiModule

    A module using class methods as handlers.

    Public instance methods that match the WebServerModule.ResponseHandler signature, and have the WebApi handler attribute will be used to respond to web server requests.

    Inheritance
    Object
    WebApiModuleBase
    WebApiModule
    Inherited Members
    WebApiModuleBase.Serializer
    WebApiModuleBase.ControllerCount
    WebApiModuleBase.RegisterControllerType<TController>()
    WebApiModuleBase.RegisterControllerType<TController>(Func<TController>)
    WebApiModuleBase.RegisterControllerType(Type)
    WebApiModuleBase.RegisterControllerType(Type, Func<WebApiController>)
    Namespace: EmbedIO.WebApi
    Syntax
    public class WebApiModule : WebApiModuleBase

    Constructors

    WebApiModule(String)

    Initializes a new instance of the WebApiModule class, using the default response serializer.

    Declaration
    public WebApiModule(string baseRoute)
    Parameters
    Type Name Description
    String baseRoute

    The base URL path served by this module.

    See Also
    BaseRoute

    WebApiModule(String, ResponseSerializerCallback)

    Initializes a new instance of the WebApiModule class, using the specified response serializer.

    Declaration
    public WebApiModule(string baseRoute, ResponseSerializerCallback serializer)
    Parameters
    Type Name Description
    String baseRoute

    The base URL path served by this module.

    ResponseSerializerCallback serializer

    A ResponseSerializerCallback used to serialize the result of controller methods returning langword_csharp_object or Task<object>.

    See Also
    BaseRoute

    Methods

    RegisterController(Type)

    Registers a controller type using a constructor.

    See RegisterControllerType(Type) for further information.

    Declaration
    public void RegisterController(Type controllerType)
    Parameters
    Type Name Description
    Type controllerType

    The type of the controller.

    See Also
    RegisterController(Type, Func<WebApiController>)
    RegisterController<TController>()
    RegisterControllerType(Type)

    RegisterController(Type, Func<WebApiController>)

    Registers a controller type using a factory method.

    See RegisterControllerType(Type, Func<WebApiController>) for further information.

    Declaration
    public void RegisterController(Type controllerType, Func<WebApiController> factory)
    Parameters
    Type Name Description
    Type controllerType

    The type of the controller.

    Func<WebApiController> factory

    The factory method used to construct instances of controllerType.

    See Also
    RegisterController(Type)
    RegisterController<TController>(Func<TController>)
    RegisterControllerType(Type, Func<WebApiController>)

    RegisterController<TController>()

    Registers a controller type using a constructor.

    See RegisterControllerType<TController>() for further information.

    Declaration
    public void RegisterController<TController>()
        where TController : WebApiController, new()
    Type Parameters
    Name Description
    TController

    The type of the controller.

    See Also
    RegisterController<TController>(Func<TController>)
    RegisterController(Type)
    RegisterControllerType<TController>()

    RegisterController<TController>(Func<TController>)

    Registers a controller type using a factory method.

    See RegisterControllerType<TController>(Func<TController>) for further information.

    Declaration
    public void RegisterController<TController>(Func<TController> factory)
        where TController : WebApiController
    Parameters
    Type Name Description
    Func<TController> factory

    The factory method used to construct instances of TController.

    Type Parameters
    Name Description
    TController

    The type of the controller.

    See Also
    RegisterController<TController>()
    RegisterController(Type, Func<WebApiController>)
    RegisterControllerType<TController>(Func<TController>)

    Comments

    Back to top Copyright © 2017-2019 Unosquare