forked from scriptcs-contrib/scriptcs-webapi
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathScriptPack.cs
More file actions
54 lines (46 loc) · 1.5 KB
/
Copy pathScriptPack.cs
File metadata and controls
54 lines (46 loc) · 1.5 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
using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using Common.Logging;
using ScriptCs;
using ScriptCs.Contracts;
namespace ScriptCs.WebApi
{
public class ScriptPack : IScriptPack
{
internal readonly ILog _logger;
internal readonly IControllerTypeManager _typeManager;
[ImportingConstructor]
public ScriptPack(ILog logger, IControllerTypeManager typeManager)
{
Guard.AgainstNullArgument("logger", logger);
Guard.AgainstNullArgument("typeManager", typeManager);
_logger = logger;
_typeManager = typeManager;
}
IScriptPackContext IScriptPack.GetContext()
{
return new WebApi(_logger, _typeManager);
}
void IScriptPack.Initialize(IScriptPackSession session)
{
Guard.AgainstNullArgument("session", session);
session.AddReference("System.Net.Http");
var namespaces = new[]
{
"System.Net.Http",
"System.Net.Http.Headers",
"System.Web.Http",
"System.Web.Http.Routing",
"Owin"
}.ToList();
namespaces.ForEach(session.ImportNamespace);
}
void IScriptPack.Terminate()
{
}
}
}