Skip to content

Commit

Permalink
Consolidate NetCore Projects Together
Browse files Browse the repository at this point in the history
  • Loading branch information
maldworth committed Jun 22, 2019
1 parent c4261bc commit 809e5f8
Show file tree
Hide file tree
Showing 12 changed files with 19 additions and 248 deletions.
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
# Sample MassTransit Quartz Scheduler

This sample contains three examples:
This sample contains two projects:

1. Net461 using TopShelf
2. NetCore Win Svc (for still deploying on a Windows Server)
3. NetCore (linux, windows, mac...)
2. NetCore (linux, windows, mac...), it uses [System.ServiceProcess.ServiceController](https://www.nuget.org/packages/System.ServiceProcess.ServiceController) which allows the process to be installed on windows as a service (using sc.exe)

The persistence mechanism used in this example is SQLServer, however Quartz.net supports [all of these](https://github.com/quartznet/quartznet/tree/master/database/tables).

Expand Down
1 change: 1 addition & 0 deletions src/NetCore/NetCore.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="2.2.0" />
<PackageReference Include="Microsoft.Extensions.Options" Version="2.2.0" />
<PackageReference Include="Quartz.Serialization.Json" Version="3.0.7" />
<PackageReference Include="System.ServiceProcess.ServiceController" Version="4.5.0" />
</ItemGroup>

<ItemGroup>
Expand Down
13 changes: 12 additions & 1 deletion src/NetCore/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
using Quartz;
using Quartz.Impl;
using System;
using System.Diagnostics;
using System.Linq;
using System.Threading.Tasks;

namespace NetCore
Expand All @@ -18,9 +20,18 @@ class Program
{
static async Task Main(string[] args)
{
var isService = !(Debugger.IsAttached || args.Contains("--console"));

var builder = CreateHostBuilder(args);

await builder.RunConsoleAsync();
if (isService)
{
await builder.RunAsServiceAsync();
}
else
{
await builder.RunConsoleAsync();
}
}

static IHostBuilder CreateHostBuilder(string[] args) =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
using System.Threading;
using System.Threading.Tasks;

namespace NetCoreWinSvc
namespace NetCore
{
public class ServiceBaseLifetime : ServiceBase, IHostLifetime
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using System.Threading;
using System.Threading.Tasks;

namespace NetCoreWinSvc
namespace NetCore
{
public static class ServiceBaseLifetimeHostExtensions
{
Expand Down
11 changes: 0 additions & 11 deletions src/NetCoreWinSvc/AppConfig.cs

This file was deleted.

63 changes: 0 additions & 63 deletions src/NetCoreWinSvc/MassTransitConsoleHostedService.cs

This file was deleted.

35 changes: 0 additions & 35 deletions src/NetCoreWinSvc/NetCoreWinSvc.csproj

This file was deleted.

98 changes: 0 additions & 98 deletions src/NetCoreWinSvc/Program.cs

This file was deleted.

14 changes: 0 additions & 14 deletions src/NetCoreWinSvc/appsettings.json

This file was deleted.

13 changes: 0 additions & 13 deletions src/NetCoreWinSvc/quartz.config

This file was deleted.

10 changes: 2 additions & 8 deletions src/Sample-Quartz.sln
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,9 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.28307.329
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NetCore", "NetCore\NetCore.csproj", "{E0E94665-623A-4CA2-99AD-D9103E17C63F}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NetCore", "NetCore\NetCore.csproj", "{E0E94665-623A-4CA2-99AD-D9103E17C63F}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NetCoreWinSvc", "NetCoreWinSvc\NetCoreWinSvc.csproj", "{B1A033D3-4D4F-4A1E-8BE7-BFF5675E2650}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Net461TopShelf", "Net461TopShelf\Net461TopShelf.csproj", "{EFA36BE4-C5FF-4492-ADD0-F5E758BD1758}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Net461TopShelf", "Net461TopShelf\Net461TopShelf.csproj", "{EFA36BE4-C5FF-4492-ADD0-F5E758BD1758}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand All @@ -19,10 +17,6 @@ Global
{E0E94665-623A-4CA2-99AD-D9103E17C63F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E0E94665-623A-4CA2-99AD-D9103E17C63F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E0E94665-623A-4CA2-99AD-D9103E17C63F}.Release|Any CPU.Build.0 = Release|Any CPU
{B1A033D3-4D4F-4A1E-8BE7-BFF5675E2650}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B1A033D3-4D4F-4A1E-8BE7-BFF5675E2650}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B1A033D3-4D4F-4A1E-8BE7-BFF5675E2650}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B1A033D3-4D4F-4A1E-8BE7-BFF5675E2650}.Release|Any CPU.Build.0 = Release|Any CPU
{EFA36BE4-C5FF-4492-ADD0-F5E758BD1758}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{EFA36BE4-C5FF-4492-ADD0-F5E758BD1758}.Debug|Any CPU.Build.0 = Debug|Any CPU
{EFA36BE4-C5FF-4492-ADD0-F5E758BD1758}.Release|Any CPU.ActiveCfg = Release|Any CPU
Expand Down

0 comments on commit 809e5f8

Please sign in to comment.