MCPcopy Create free account
hub / github.com/HangfireIO/Hangfire.Samples / Program

Class Program

Hangfire.ConsoleApplication/Program.cs:9–39  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7namespace Hangfire.ConsoleApplication
8{
9 class Program
10 {
11 static void Main()
12 {
13 // Configure AppDomain parameter to simplify the config – http://stackoverflow.com/a/3501950/1317575
14 AppDomain.CurrentDomain.SetData("DataDirectory", Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "App_Data"));
15
16 LogProvider.SetCurrentLogProvider(new ColouredConsoleLogProvider());
17
18 const string endpoint = "http://localhost:12345";
19
20 using (WebApp.Start<Startup>(endpoint))
21 {
22 Console.WriteLine();
23 Console.WriteLine("{0} Hangfire Server started.", DateTime.Now);
24 Console.WriteLine("{0} Dashboard is available at {1}/hangfire", DateTime.Now, endpoint);
25 Console.WriteLine();
26 Console.WriteLine("{0} Type JOB to add a background job.", DateTime.Now);
27 Console.WriteLine("{0} Press ENTER to exit...", DateTime.Now);
28
29 string command;
30 while ((command = Console.ReadLine()) != String.Empty)
31 {
32 if ("job".Equals(command, StringComparison.OrdinalIgnoreCase))
33 {
34 BackgroundJob.Enqueue(() => Console.WriteLine("{0} Background job completed successfully!", DateTime.Now.ToString()));
35 }
36 }
37 }
38 }
39 }
40}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected