using System; using System.Threading.Tasks; using EmbedIO.Utilities; namespace EmbedIO.WebApi { /// /// 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. /// public class WebApiModule : WebApiModuleBase { /// /// Initializes a new instance of the class, /// using the default response serializer. /// /// The base URL path served by this module. /// /// public WebApiModule(string baseRoute) : base(baseRoute) { } /// /// Initializes a new instance of the class, /// using the specified response serializer. /// /// The base URL path served by this module. /// A used to serialize /// the result of controller methods returning /// or Task<object>. /// is . /// /// public WebApiModule(string baseRoute, ResponseSerializerCallback serializer) : base(baseRoute, serializer) { } /// /// Registers a controller type using a constructor. /// See /// for further information. /// /// The type of the controller. /// /// /// public void RegisterController() where TController : WebApiController, new() => RegisterControllerType(typeof(TController)); /// /// Registers a controller type using a factory method. /// See /// for further information. /// /// The type of the controller. /// The factory method used to construct instances of . /// /// /// public void RegisterController(Func factory) where TController : WebApiController => RegisterControllerType(typeof(TController), factory); /// /// Registers a controller type using a constructor. /// See /// for further information. /// /// The type of the controller. /// /// /// public void RegisterController(Type controllerType) => RegisterControllerType(controllerType); /// /// Registers a controller type using a factory method. /// See /// for further information. /// /// The type of the controller. /// The factory method used to construct instances of . /// /// /// public void RegisterController(Type controllerType, Func factory) => RegisterControllerType(controllerType, factory); } }