Skip to content

Commit

Permalink
added support for DotNet 4.5, 4.6, NetStandard1.3, 1.4, 1.5,1.6 and a…
Browse files Browse the repository at this point in the history
…dded new sample console project for DotNet4.6
  • Loading branch information
AustinWinstanley committed Oct 19, 2017
1 parent f19f1c1 commit 242ce14
Show file tree
Hide file tree
Showing 11 changed files with 326 additions and 11 deletions.
9 changes: 8 additions & 1 deletion Hangfire.Raven.sln
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.26923.0
VisualStudioVersion = 15.0.27004.2005
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "_", "_", "{8CF2D2F6-BEFE-47FE-B141-0017FC6F97D8}"
ProjectSection(SolutionItems) = preProject
Expand All @@ -20,6 +20,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Hangfire.Raven.Samples.AspN
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Hangfire.Raven.Samples.Console", "samples\Hangfire.Raven.Samples.Console\Hangfire.Raven.Samples.Console.csproj", "{A7691484-4466-4F8C-9B57-C77EA0FF4670}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Hangfire.Raven.Samples.Console.DotNet46", "samples\Hangfire.Raven.Samples.Console.DotNet46\Hangfire.Raven.Samples.Console.DotNet46.csproj", "{547D4C07-FC38-4920-9891-D04A5027C0A4}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -38,6 +40,10 @@ Global
{A7691484-4466-4F8C-9B57-C77EA0FF4670}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A7691484-4466-4F8C-9B57-C77EA0FF4670}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A7691484-4466-4F8C-9B57-C77EA0FF4670}.Release|Any CPU.Build.0 = Release|Any CPU
{547D4C07-FC38-4920-9891-D04A5027C0A4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{547D4C07-FC38-4920-9891-D04A5027C0A4}.Debug|Any CPU.Build.0 = Debug|Any CPU
{547D4C07-FC38-4920-9891-D04A5027C0A4}.Release|Any CPU.ActiveCfg = Release|Any CPU
{547D4C07-FC38-4920-9891-D04A5027C0A4}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -46,6 +52,7 @@ Global
{BA18F6BF-5613-4B9D-A57A-C05C51148EC5} = {EF9BFE2C-0386-4EC4-83EC-D7E315F56735}
{34B7ED1A-796C-40B8-A8B9-D12D88C8A880} = {F42EDD6E-883B-4067-94AD-72EC7A095BF2}
{A7691484-4466-4F8C-9B57-C77EA0FF4670} = {F42EDD6E-883B-4067-94AD-72EC7A095BF2}
{547D4C07-FC38-4920-9891-D04A5027C0A4} = {F42EDD6E-883B-4067-94AD-72EC7A095BF2}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {1E710484-845C-4FAB-9F3F-2E3384385445}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<Version>3.1.1</Version>
<AssemblyVersion>3.1.1.0</AssemblyVersion>
<FileVersion>3.1.1.0</FileVersion>
<Version>3.2.0</Version>
<AssemblyVersion>3.2.0.0</AssemblyVersion>
<FileVersion>3.2.0.0</FileVersion>
<Description>RavenDB job storage for Hangfire - AspNetCore Example</Description>
<Authors>CadyIO &lt;[email protected]&gt;</Authors>
<Company>Cady IO</Company>
Expand Down
14 changes: 14 additions & 0 deletions samples/Hangfire.Raven.Samples.Console.DotNet46/App.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6" />
</startup>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-10.0.0.0" newVersion="10.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
10 changes: 10 additions & 0 deletions samples/Hangfire.Raven.Samples.Console.DotNet46/GenericServices.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
namespace Hangfire.Raven.Samples.Console.DotNet46
{
public class GenericServices<TType>
{
public void Method<TMethod>(TType arg1, TMethod arg2)
{
System.Console.WriteLine("Arg1: {0}, Arg2: {1}", arg1, arg2);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{547D4C07-FC38-4920-9891-D04A5027C0A4}</ProjectGuid>
<OutputType>Exe</OutputType>
<RootNamespace>Hangfire.Raven.Samples.Console.DotNet46</RootNamespace>
<AssemblyName>Hangfire.Raven.Samples.Console.DotNet46</AssemblyName>
<TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Hangfire.Core, Version=1.6.17.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\Hangfire.Core.1.6.17\lib\net45\Hangfire.Core.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=10.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\..\packages\Newtonsoft.Json.10.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="Owin, Version=1.0.0.0, Culture=neutral, PublicKeyToken=f0ebd12fd5e55cc5, processorArchitecture=MSIL">
<HintPath>..\..\packages\Owin.1.0\lib\net40\Owin.dll</HintPath>
</Reference>
<Reference Include="Raven.Abstractions, Version=3.5.4.0, Culture=neutral, PublicKeyToken=37f41c7f99471593, processorArchitecture=MSIL">
<HintPath>..\..\packages\RavenDB.Client.3.5.4\lib\net45\Raven.Abstractions.dll</HintPath>
</Reference>
<Reference Include="Raven.Client.Lightweight, Version=3.5.4.0, Culture=neutral, PublicKeyToken=37f41c7f99471593, processorArchitecture=MSIL">
<HintPath>..\..\packages\RavenDB.Client.3.5.4\lib\net45\Raven.Client.Lightweight.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.ComponentModel.Composition" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="GenericServices.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Services.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\Hangfire.Raven\Hangfire.Raven.csproj">
<Project>{ba18f6bf-5613-4b9d-a57a-c05c51148ec5}</Project>
<Name>Hangfire.Raven</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
56 changes: 56 additions & 0 deletions samples/Hangfire.Raven.Samples.Console.DotNet46/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
using System;
using Hangfire.Raven.Storage;

namespace Hangfire.Raven.Samples.Console.DotNet46
{
class Program
{
public static int x = 0;

public static void Main()
{
try
{
// you can use Raven Storage and specify the connection string name
GlobalConfiguration.Configuration
.UseColouredConsoleLogProvider()
.UseRavenStorage("RavenDebug");

// you can use Raven Storage and specify the connection string and database name
//GlobalConfiguration.Configuration
// .UseColouredConsoleLogProvider()
// .UseRavenStorage("http://localhost:9090", "HangfireConsole");

// you can use Raven Embedded Storage which runs in memory!
//GlobalConfiguration.Configuration
// .UseColouredConsoleLogProvider()
// .UseEmbeddedRavenStorage();

//you have to create an instance of background job server at least once for background jobs to run
var client = new BackgroundJobServer();

// Run once
BackgroundJob.Enqueue(() => System.Console.WriteLine("Background Job: Hello, world!"));

BackgroundJob.Enqueue(() => Test());

// Run every minute
RecurringJob.AddOrUpdate(() => Test(), Cron.Minutely);

System.Console.WriteLine("Press Enter to exit...");
System.Console.ReadLine();
}
catch (Exception ex)
{
throw ex;
}
}

[AutomaticRetry(Attempts = 2, LogEvents = true, OnAttemptsExceeded = AttemptsExceededAction.Delete)]
public static void Test()
{
System.Console.WriteLine($"{x++} Cron Job: Hello, world!");
//throw new ArgumentException("fail");
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Hangfire.Raven.Samples.Console.DotNet46")]
[assembly: AssemblyDescription("RavenDB job storage for Hangfire - .Net 46 Console Example")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Cady IO")]
[assembly: AssemblyProduct("Hangfire.Raven.Samples.Console.DotNet46")]
[assembly: AssemblyCopyright("Copyright © Cady LLC")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]

// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("547d4c07-fc38-4920-9891-d04a5027c0a4")]

// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("3.2.0.0")]
[assembly: AssemblyFileVersion("3.2.0.0")]
107 changes: 107 additions & 0 deletions samples/Hangfire.Raven.Samples.Console.DotNet46/Services.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Threading;

namespace Hangfire.Raven.Samples.Console.DotNet46
{
public class Services
{
private static readonly Random _random = new Random();

public void EmptyDefault()
{
}

[Queue("critical")]
public void EmptyCritical()
{
}

[AutomaticRetry(Attempts = 0)]
public void Error()
{
System.Console.WriteLine("Beginning error task...");
throw new InvalidOperationException(null, new FileLoadException());
}

[Queue("critical")]
public void Random(int number)
{
int time;
lock (_random)
{
time = _random.Next(10);
}

if (time < 5)
{
throw new Exception();
}

Thread.Sleep(TimeSpan.FromSeconds(5 + time));
System.Console.WriteLine("Finished task: " + number);
}

public void Cancelable(int iterationCount, IJobCancellationToken token)
{
try
{
for (var i = 1; i <= iterationCount; i++)
{
Thread.Sleep(1000);
System.Console.WriteLine("Performing step {0} of {1}...", i, iterationCount);

token.ThrowIfCancellationRequested();
}
}
catch (OperationCanceledException)
{
System.Console.WriteLine("Cancellation requested, exiting...");
throw;
}
}

public void Args(string name, int authorId, DateTime createdAt)
{
System.Console.WriteLine("{0}, {1}, {2}", name, authorId, createdAt);
}

public void Custom(int id, string[] values, CustomObject objects, DayOfWeek dayOfWeek)
{
}

public void FullArgs(
bool b,
int i,
char c,
DayOfWeek e,
string s,
TimeSpan t,
DateTime d,
CustomObject o,
string[] sa,
int[] ia,
long[] ea,
object[] na,
List<string> sl)
{
}

public class CustomObject
{
public int Id { get; set; }
public CustomObject[] Children { get; set; }
}

public void Write(char character)
{
System.Console.Write(character);
}

public void WriteBlankLine()
{
System.Console.WriteLine();
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Hangfire.Core" version="1.6.17" targetFramework="net46" />
<package id="Newtonsoft.Json" version="10.0.3" targetFramework="net46" />
<package id="Owin" version="1.0" targetFramework="net46" />
<package id="RavenDB.Client" version="3.5.4" targetFramework="net46" />
</packages>
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@

<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<Version>3.1.1</Version>
<AssemblyVersion>3.1.1.0</AssemblyVersion>
<FileVersion>3.1.1.0</FileVersion>
<Version>3.2.0</Version>
<AssemblyVersion>3.2.0.0</AssemblyVersion>
<FileVersion>3.2.0.0</FileVersion>
<Description>RavenDB job storage for Hangfire - Console Example</Description>
<Authors>CadyIO &lt;[email protected]&gt;</Authors>
<Company>Cady IO</Company>
Expand Down
8 changes: 4 additions & 4 deletions src/Hangfire.Raven/Hangfire.Raven.csproj
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<Version>3.1.1</Version>
<AssemblyVersion>3.1.1.0</AssemblyVersion>
<FileVersion>3.1.1.0</FileVersion>
<TargetFrameworks>netstandard2.0;netstandard1.6;netstandard1.5;netstandard1.4;netstandard1.3;net46;net45</TargetFrameworks>
<Version>3.2.0</Version>
<AssemblyVersion>3.2.0.0</AssemblyVersion>
<FileVersion>3.2.0.0</FileVersion>
<Description>RavenDB job storage for Hangfire</Description>
<Authors>CadyIO &lt;[email protected]&gt;</Authors>
<Company>Cady IO</Company>
Expand Down

0 comments on commit 242ce14

Please sign in to comment.