forked from ServiceStackV3/ServiceStack.Contrib
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathServiceManager.cs
More file actions
44 lines (35 loc) · 1.05 KB
/
ServiceManager.cs
File metadata and controls
44 lines (35 loc) · 1.05 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
using System;
using System.Collections.Generic;
using System.Reflection;
using Funq;
using ServiceStack.Logging;
namespace ServiceStack.ServiceHost
{
public class ServiceManager
: IDisposable
{
private static readonly ILog Log = LogManager.GetLogger(typeof (ServiceManager));
public Container Container { get; private set; }
public ServiceController ServiceController { get; private set; }
private readonly Assembly[] assembliesWithServices;
public ServiceManager(params Assembly[] assembliesWithServices)
{
this.assembliesWithServices = assembliesWithServices;
this.ServiceController = new ServiceController();
}
public void Init()
{
this.Container = new Container();
var typeFactory = new ExpressionTypeFunqContainer(this.Container);
this.ServiceController.Register(typeFactory, assembliesWithServices);
typeFactory.RegisterTypes(this.ServiceController.ServiceTypes);
}
public void Dispose()
{
if (this.Container != null)
{
this.Container.Dispose();
}
}
}
}