-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added support for DotNet 4.5, 4.6, NetStandard1.3, 1.4, 1.5,1.6 and a…
…dded new sample console project for DotNet4.6
- Loading branch information
1 parent
f19f1c1
commit 242ce14
Showing
11 changed files
with
326 additions
and
11 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 <[email protected]></Authors> | ||
<Company>Cady IO</Company> | ||
|
14 changes: 14 additions & 0 deletions
14
samples/Hangfire.Raven.Samples.Console.DotNet46/App.config
This file contains 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
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
10
samples/Hangfire.Raven.Samples.Console.DotNet46/GenericServices.cs
This file contains 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
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); | ||
} | ||
} | ||
} |
78 changes: 78 additions & 0 deletions
78
...es/Hangfire.Raven.Samples.Console.DotNet46/Hangfire.Raven.Samples.Console.DotNet46.csproj
This file contains 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
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
56
samples/Hangfire.Raven.Samples.Console.DotNet46/Program.cs
This file contains 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
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"); | ||
} | ||
} | ||
} |
36 changes: 36 additions & 0 deletions
36
samples/Hangfire.Raven.Samples.Console.DotNet46/Properties/AssemblyInfo.cs
This file contains 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
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
107
samples/Hangfire.Raven.Samples.Console.DotNet46/Services.cs
This file contains 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
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(); | ||
} | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
samples/Hangfire.Raven.Samples.Console.DotNet46/packages.config
This file contains 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
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> |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 <[email protected]></Authors> | ||
<Company>Cady IO</Company> | ||
|
This file contains 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
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 <[email protected]></Authors> | ||
<Company>Cady IO</Company> | ||
|