Created
November 9, 2012 11:03
-
-
Save trullock/4045159 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static void Main(string[] args) | |
{ | |
HostFactory.Run(x => | |
{ | |
x.Service<IService>(s => | |
{ | |
s.SetServiceName("bar"); | |
s.ConstructUsing(name => | |
{ | |
try | |
{ | |
return new MyService(); | |
} | |
catch (Exception e) | |
{ | |
Console.WriteLine(e); | |
throw e; | |
} | |
}); | |
s.WhenStarted(r => r.Start()); | |
s.WhenStopped(r => r.Stop()); | |
}); | |
x.SetDescription("foo"); | |
x.SetDisplayName("bar"); | |
x.SetServiceName("bar"); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment