forked from ServiceStack/ServiceStack
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathIAppHost.cs
More file actions
133 lines (111 loc) · 3.82 KB
/
Copy pathIAppHost.cs
File metadata and controls
133 lines (111 loc) · 3.82 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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
using System;
using System.Collections.Generic;
using ServiceStack.Html;
using ServiceStack.IO;
using ServiceStack.ServiceHost;
namespace ServiceStack.WebHost.Endpoints
{
/// <summary>
/// ASP.NET or HttpListener ServiceStack host
/// </summary>
public interface IAppHost : IResolver
{
/// <summary>
/// Register dependency in AppHost IOC on Startup
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="instance"></param>
void Register<T>(T instance);
/// <summary>
/// AutoWired Registration of an interface with a concrete type in AppHost IOC on Startup.
/// </summary>
/// <typeparam name="T"></typeparam>
/// <typeparam name="TAs"></typeparam>
void RegisterAs<T, TAs>() where T : TAs;
/// <summary>
/// Allows the clean up for executed autowired services and filters.
/// Calls directly after services and filters are executed.
/// </summary>
/// <param name="instance"></param>
void Release(object instance);
/// <summary>
/// Called at the end of each request. Enables Request Scope.
/// </summary>
void OnEndRequest();
/// <summary>
/// Register user-defined custom routes.
/// </summary>
IServiceRoutes Routes { get; }
/// <summary>
/// Register custom ContentType serializers
/// </summary>
IContentTypeFilter ContentTypeFilters { get; }
/// <summary>
/// Add Request Filters, to be applied before the dto is deserialized
/// </summary>
List<Action<IHttpRequest, IHttpResponse>> PreRequestFilters { get; }
/// <summary>
/// Add Request Filters
/// </summary>
List<Action<IHttpRequest, IHttpResponse, object>> RequestFilters { get; }
/// <summary>
/// Add Response Filters
/// </summary>
List<Action<IHttpRequest, IHttpResponse, object>> ResponseFilters { get; }
/// <summary>
/// Add alternative HTML View Engines
/// </summary>
List<IViewEngine> ViewEngines { get; }
/// <summary>
/// Provide an exception handler for un-caught exceptions
/// </summary>
HandleUncaughtExceptionDelegate ExceptionHandler { get; set; }
/// <summary>
/// Provide an exception handler for unhandled exceptions
/// </summary>
HandleServiceExceptionDelegate ServiceExceptionHandler { get; set; }
/// <summary>
/// Provide a catch-all handler that doesn't match any routes
/// </summary>
List<HttpHandlerResolverDelegate> CatchAllHandlers { get; }
/// <summary>
/// Provide a custom model minder for a specific Request DTO
/// </summary>
Dictionary<Type, Func<IHttpRequest, object>> RequestBinders { get; }
/// <summary>
/// The AppHost config
/// </summary>
EndpointHostConfig Config { get; }
/// <summary>
/// Register an Adhoc web service on Startup
/// </summary>
/// <param name="serviceType"></param>
/// <param name="atRestPaths"></param>
void RegisterService(Type serviceType, params string[] atRestPaths);
/// <summary>
/// List of pre-registered and user-defined plugins to be enabled in this AppHost
/// </summary>
List<IPlugin> Plugins { get; }
/// <summary>
/// Apply plugins to this AppHost
/// </summary>
/// <param name="plugins"></param>
void LoadPlugin(params IPlugin[] plugins);
/// <summary>
/// Virtual access to file resources
/// </summary>
IVirtualPathProvider VirtualPathProvider { get; set; }
/// <summary>
/// Create a service runner for IService actions
/// </summary>
IServiceRunner<TRequest> CreateServiceRunner<TRequest>(ActionContext actionContext);
/// <summary>
/// Resolve the absolute url for this request
/// </summary>
string ResolveAbsoluteUrl(string virtualPath, IHttpRequest httpReq);
}
public interface IHasAppHost
{
IAppHost AppHost { get; }
}
}