forked from NancyFx/Nancy
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathINancyModule.cs
More file actions
106 lines (91 loc) · 4.72 KB
/
Copy pathINancyModule.cs
File metadata and controls
106 lines (91 loc) · 4.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
namespace Nancy
{
using System.Collections.Generic;
using System.ComponentModel;
using Nancy.ModelBinding;
using Nancy.Responses.Negotiation;
using Nancy.Routing;
using Nancy.Validation;
using Nancy.ViewEngines;
/// <summary>
/// Nancy module base interface
/// Defines all the properties / behaviour needed by Nancy internally
/// </summary>
public interface INancyModule
{
/// <summary><para>
/// The post-request hook
/// </para><para>
/// The post-request hook is called after the response is created by the route execution.
/// It can be used to rewrite the response or add/remove items from the context.
/// </para></summary>
AfterPipeline After { get; set; }
/// <summary><para>
/// The pre-request hook
/// </para><para>
/// The PreRequest hook is called prior to executing a route. If any item in the
/// pre-request pipeline returns a response then the route is not executed and the
/// response is returned.
/// </para></summary>
BeforePipeline Before { get; set; }
/// <summary><para>
/// The error hook
/// </para><para>
/// The error hook is called if an exception is thrown at any time during executing
/// the PreRequest hook, a route and the PostRequest hook. It can be used to set
/// the response and/or finish any ongoing tasks (close database session, etc).
/// </para></summary>
ErrorPipeline OnError { get; set; }
/// <summary>
/// Gets or sets the current Nancy context
/// </summary><value>A <see cref="T:Nancy.NancyContext" /> instance.</value>
NancyContext Context { get; set; }
/// <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="P:Nancy.NancyModuleBase.Response" /> or one of the types that can implicitly be types into a <see cref="P:Nancy.NancyModuleBase.Response" />.</remarks>
IResponseFormatter Response { get; set; }
/// <summary>
/// Gets or sets the model binder locator
/// </summary>
IModelBinderLocator ModelBinderLocator { get; set; }
/// <summary>
/// Gets or sets the model validation result
/// </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
ModelValidationResult ModelValidationResult { get; set; }
/// <summary>
/// Gets or sets the validator locator.
/// </summary>
IModelValidatorLocator ValidatorLocator { get; set; }
/// <summary>
/// Gets or sets an <see cref="Request" /> instance that represents the current request.
/// </summary><value>An <see cref="Request" /> instance.</value>
Request Request { get; set; }
/// <summary>
/// The extension point for accessing the view engines in Nancy.
/// </summary><value>An <see cref="T:Nancy.ViewEngines.IViewFactory" /> instance.</value><remarks>This is automatically set by Nancy at runtime.</remarks>
IViewFactory ViewFactory { get; set; }
/// <summary>
/// Get the root path of the routes in the current module.
/// </summary><value>A <see cref="T:System.String" /> containing the root path of the module or <see langword="null" /> if no root path should be used.</value><remarks>All routes will be relative to this root path.</remarks>
string ModulePath { get; }
/// <summary>
/// Gets all declared routes by the module.
/// </summary><value>A <see cref="T:System.Collections.Generic.IEnumerable`1" /> instance, containing all <see cref="T:Nancy.Routing.Route" /> instances declared by the module.</value>
IEnumerable<Route> Routes { get; }
/// <summary>
/// Gets or sets the dynamic object used to locate text resources.
/// </summary>
dynamic Text { get; }
/// <summary>
/// Renders a view from inside a route handler.
/// </summary>
/// <value>A <see cref="ViewRenderer"/> instance that is used to determine which view that should be rendered.</value>
ViewRenderer View { get; }
/// <summary>
/// Used to negotiate the content returned based on Accepts header.
/// </summary>
/// <value>A <see cref="Negotiator"/> instance that is used to negotiate the content returned.</value>
Negotiator Negotiate { get; }
}
}