using System;
namespace EmbedIO.WebApi
{
///
/// Provides extension methods for .
///
public static class WebApiModuleExtensions
{
///
/// Registers a controller type using a constructor.
/// See
/// for further information.
///
/// The type of the controller.
/// The on which this method is called.
/// with the controller type registered.
///
///
///
public static WebApiModule WithController(this WebApiModule @this)
where TController : WebApiController, new()
{
@this.RegisterController();
return @this;
}
///
/// Registers a controller type using a factory method.
/// See
/// for further information.
///
/// The type of the controller.
/// The on which this method is called.
/// The factory method used to construct instances of .
/// with the controller type registered.
///
///
///
public static WebApiModule WithController(this WebApiModule @this, Func factory)
where TController : WebApiController
{
@this.RegisterController(factory);
return @this;
}
///
/// Registers a controller type using a constructor.
/// See
/// for further information.
///
/// The on which this method is called.
/// The type of the controller.
/// with the controller type registered.
///
///
///
public static WebApiModule WithController(this WebApiModule @this, Type controllerType)
{
@this.RegisterController(controllerType);
return @this;
}
///
/// Registers a controller type using a factory method.
/// See
/// for further information.
///
/// The on which this method is called.
/// The type of the controller.
/// The factory method used to construct instances of .
/// with the controller type registered.
///
///
///
public static WebApiModule WithController(this WebApiModule @this, Type controllerType, Func factory)
{
@this.RegisterController(controllerType, factory);
return @this;
}
}
}