Skip to content
Permalink
Browse files

Initial Commit.

  • Loading branch information...
houseofcat committed Feb 24, 2019
1 parent faed87e commit 601d0ac2125b81bf5dff63fa61b35a896bcc056e
@@ -3,7 +3,9 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.28307.421
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HangFire.NetCore.Demo", "HangFire.NetCore.Demo\HangFire.NetCore.Demo.csproj", "{CEC3B6FD-0745-4211-830B-874E730F4025}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "HangFire.NetCore.ClientDemo", "HangFire.NetCore.Demo\HangFire.NetCore.ClientDemo.csproj", "{CEC3B6FD-0745-4211-830B-874E730F4025}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HangFire.NetCore.ServerDemo", "HangFire.NetCore.ServerDemo\HangFire.NetCore.ServerDemo.csproj", "{E3DB5824-5336-4351-93AC-73B0FAEE64A5}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -15,6 +17,10 @@ Global
{CEC3B6FD-0745-4211-830B-874E730F4025}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CEC3B6FD-0745-4211-830B-874E730F4025}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CEC3B6FD-0745-4211-830B-874E730F4025}.Release|Any CPU.Build.0 = Release|Any CPU
{E3DB5824-5336-4351-93AC-73B0FAEE64A5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E3DB5824-5336-4351-93AC-73B0FAEE64A5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E3DB5824-5336-4351-93AC-73B0FAEE64A5}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E3DB5824-5336-4351-93AC-73B0FAEE64A5}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -0,0 +1,23 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.2</TargetFramework>
<LangVersion>latest</LangVersion>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Hangfire.Core" Version="1.6.22" />
<PackageReference Include="Hangfire.SqlServer" Version="1.6.22" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="2.2.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.FileExtensions" Version="2.2.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="2.2.0" />
</ItemGroup>

<ItemGroup>
<None Update="appSettings.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>

</Project>

This file was deleted.

Oops, something went wrong.
@@ -1,12 +1,39 @@
using System;
using Hangfire;
using Microsoft.Extensions.Configuration;
using System;
using System.IO;
using System.Threading.Tasks;

namespace HangFire.NetCore.Demo
namespace HangFire.NetCore.ClientDemo
{
class Program
public class Program
{
static void Main(string[] args)
private static IConfigurationRoot _configuration { get; set; }

public static async Task Main(string[] args)
{
Console.WriteLine("Hello World!");
ConfigureApplication();

await Console.Out.WriteLineAsync("HangFire Client has started. Sending test message...");

BackgroundJob.Enqueue(() => Console.WriteLine($"Hello TestHost Sever {DateTime.Now}!"));

await Console.Out.WriteLineAsync("HangFire Client finished its work. Press return to exit...");
await Console.In.ReadLineAsync();
}

private static void ConfigureApplication()
{
var builder = new ConfigurationBuilder()
.SetBasePath(Directory.GetCurrentDirectory())
.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true);

_configuration = builder.Build();

GlobalConfiguration
.Configuration
.UseColouredConsoleLogProvider()
.UseSqlServerStorage(_configuration.GetConnectionString("HangFire"));
}
}
}
@@ -0,0 +1,5 @@
{
"ConnectionStrings": {
"HangFire": "Data Source=(local);Initial Catalog=HangFire;User Id=HangFire;Password=HangFireIsAwesome;Integrated Security=SSPI;"
}
}
@@ -0,0 +1,23 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.2</TargetFramework>
<LangVersion>latest</LangVersion>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Hangfire.Core" Version="1.6.22" />
<PackageReference Include="Hangfire.SqlServer" Version="1.6.22" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="2.2.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.FileExtensions" Version="2.2.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="2.2.0" />
</ItemGroup>

<ItemGroup>
<None Update="appSettings.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>

</Project>
@@ -0,0 +1,46 @@
using Hangfire;
using Microsoft.Extensions.Configuration;
using System;
using System.IO;
using System.Threading.Tasks;

namespace HangFire.NetCore.ServerDemo
{
public class Program
{
private static IConfigurationRoot _configuration { get; set; }
private static BackgroundJobServer _backgroundJobServer { get; set; }

public static async Task Main(string[] args)
{
AppDomain.CurrentDomain.ProcessExit += new EventHandler(GracefulServerShutdown);

ConfigureApplication();

await Console.Out.WriteLineAsync("HangFire Processing Server has started. Press any key to exit...");
await Console.In.ReadLineAsync();
}

private static void ConfigureApplication()
{
var builder = new ConfigurationBuilder()
.SetBasePath(Directory.GetCurrentDirectory())
.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true);

_configuration = builder.Build();

GlobalConfiguration
.Configuration
.UseColouredConsoleLogProvider()
.UseSqlServerStorage(_configuration.GetConnectionString("HangFire"));

_backgroundJobServer = new BackgroundJobServer();
}

private static void GracefulServerShutdown(object sender, EventArgs e)
{
_backgroundJobServer.SendStop();
_backgroundJobServer.Dispose();
}
}
}
@@ -0,0 +1,5 @@
{
"ConnectionStrings": {
"HangFire": "Data Source=(local);Initial Catalog=HangFire;User Id=HangFire;Password=HangFireIsAwesome;Integrated Security=SSPI;"
}
}

0 comments on commit 601d0ac

Please sign in to comment.
You can’t perform that action at this time.