Skip to content

Instantly share code, notes, and snippets.

@thecodejunkie
Created January 30, 2011 21:30
Show Gist options
  • Save thecodejunkie/803269 to your computer and use it in GitHub Desktop.
Save thecodejunkie/803269 to your computer and use it in GitHub Desktop.
What INancyModule interface would look like if extracted from NancyModule
public interface INancyModule
{
/// <summary>
/// Gets or sets an <see cref="ITemplateEngineSelector"/> which represents the current application context
/// </summary>
ITemplateEngineSelector TemplateEngineSelector { get; set; }
/// <summary>
/// Gets <see cref="RouteDictionary"/> for declaring actions for DELETE requests.
/// </summary>
/// <value>A <see cref="RouteDictionary"/> instance.</value>
RouteDictionary Delete { get; }
/// <summary>
/// Gets <see cref="RouteDictionary"/> for declaring actions for GET requests.
/// </summary>
/// <value>A <see cref="RouteDictionary"/> instance.</value>
/// <remarks>These actions will also be used when a HEAD request is recieved.</remarks>
RouteDictionary Get { get; }
string ModulePath { get; }
/// <summary>
/// Gets <see cref="RouteDictionary"/> for declaring actions for POST requests.
/// </summary>
/// <value>A <see cref="RouteDictionary"/> instance.</value>
RouteDictionary Post { get; }
/// <summary>
/// Gets <see cref="RouteDictionary"/> for declaring actions for PUT requests.
/// </summary>
/// <value>A <see cref="RouteDictionary"/> instance.</value>
RouteDictionary Put { get; }
/// <summary>
/// Gets or sets an <see cref="IRequest"/> instance that represents the current request.
/// </summary>
/// <value>An <see cref="IRequest"/> instance.</value>
IRequest Request { get; set; }
/// <summary>
/// An extension point for adding support for view engines.
/// </summary>
/// <value>This property will always return <see langword="null" /> because it acts as an extension point.</value>
/// <remarks>Extension methods to this property should always return <see cref="Response"/> or one of the types that can implicitly be types into a <see cref="Response"/>.</remarks>
IViewEngine View { get; }
/// <summary>
/// An extension point for adding support for formatting response contents.
/// </summary>
/// <value>This property will always return <see langword="null" /> because it acts as an extension point.</value>
/// <remarks>Extension methods to this property should always return <see cref="Response"/> or one of the types that can implicitly be types into a <see cref="Response"/>.</remarks>
IResponseFormatter Response { get; }
/// <param name="method">A <see cref="string"/> containing the http request method for which the routes should be returned.</param>
/// <returns>An <see cref="IDictionary{TKey,TValue}"/> containing the routes.</returns>
/// <remarks>Valid values are delete, get, post and put. The parameter is not case sensitive.</remarks>
RouteDictionary GetRoutes(string method);
/// <summary>
/// Renders the view based on the extension without a model.
/// </summary>
/// <param name="name">The path to the view</param>
Action<Stream> SmartView(string name);
/// <summary>
/// Renders the view based on the extension with a model.
/// </summary>
/// <param name="name">The path to the view</param>
/// <param name="model">The model to pass to the view</param>
Action<Stream> SmartView<TModel>(string name, TModel model);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment