113/03/12
This commit is contained in:
@@ -5,6 +5,11 @@ VisualStudioVersion = 17.9.34607.119
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HangfireExample", "HangfireExample\HangfireExample.csproj", "{5FF0CD69-D107-4F03-96EF-876BE9D5DA23}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "方案項目", "方案項目", "{A3B14127-2240-45B0-9441-386F1812E004}"
|
||||
ProjectSection(SolutionItems) = preProject
|
||||
README.md = README.md
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
|
||||
@@ -7,4 +7,9 @@
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Hangfire" Version="1.8.11" />
|
||||
<PackageReference Include="Hangfire.Storage.SQLite" Version="0.4.1" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
@@ -1,2 +1,11 @@
|
||||
// See https://aka.ms/new-console-template for more information
|
||||
Console.WriteLine("Hello, World!");
|
||||
using Hangfire;
|
||||
using Hangfire.SqlServer;
|
||||
using Hangfire.Storage.SQLite;
|
||||
|
||||
// 第三方擴充: Hangfire.Storage.SQLite 0.4.1
|
||||
GlobalConfiguration
|
||||
.Configuration
|
||||
.UseSQLiteStorage("HangfireExample.db");
|
||||
|
||||
|
||||
|
||||
|
||||
71
README.md
71
README.md
@@ -1 +1,70 @@
|
||||
# HangfireExample
|
||||
# Getting Started
|
||||
|
||||
## Storage
|
||||
Hangfire 會將所有相關資訊會被序列化後保存到儲存區,如類型、方法或參數等。
|
||||
|
||||
儲存模型官方預設有以下幾種
|
||||
|
||||
<table>
|
||||
<thead>
|
||||
<td></td>
|
||||
<td>Sql Server 2008+</td>
|
||||
<td>Redis 2.6.12+</td>
|
||||
<td>In-Memory</td>
|
||||
<td>Price</td>
|
||||
</thead>
|
||||
<tbody>
|
||||
<td>Open</td>
|
||||
<td>✔</td>
|
||||
<td></td>
|
||||
<td>✔</td>
|
||||
<td>free</td>
|
||||
</tbody>
|
||||
<tbody>
|
||||
<td>Startup</td>
|
||||
<td>✔</td>
|
||||
<td>✔</td>
|
||||
<td>✔</td>
|
||||
<td>$500 / per year</td>
|
||||
</tbody>
|
||||
<tbody>
|
||||
<td>Business</td>
|
||||
<td>✔</td>
|
||||
<td>✔</td>
|
||||
<td>✔</td>
|
||||
<td>$1,500 / per year</td>
|
||||
</tbody>
|
||||
<tbody>
|
||||
<td>Enterprise</td>
|
||||
<td>✔</td>
|
||||
<td>✔</td>
|
||||
<td>✔</td>
|
||||
<td>$4,500 / per year</td>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
資料來源日期: 2024/03/12
|
||||
|
||||
```
|
||||
// Version 1.8
|
||||
GlobalConfiguration
|
||||
.Configuration
|
||||
.SetDataCompatibilityLevel(CompatibilityLevel.Version_180)
|
||||
.UseSimpleAssemblyNameTypeSerializer()
|
||||
.UseRecommendedSerializerSettings()
|
||||
.UseSqlServerStorage("Database=Hangfire.Sample; Integrated Security=True;");
|
||||
|
||||
// Version 1.7
|
||||
GlobalConfiguration
|
||||
.Configuration
|
||||
.SetDataCompatibilityLevel(CompatibilityLevel.Version_170)
|
||||
.UseSimpleAssemblyNameTypeSerializer()
|
||||
.UseRecommendedSerializerSettings()
|
||||
.UseSqlServerStorage("Database=Hangfire.Sample; Integrated Security=True;", new SqlServerStorageOptions
|
||||
{
|
||||
CommandBatchMaxTimeout = TimeSpan.FromMinutes(5),
|
||||
SlidingInvisibilityTimeout = TimeSpan.FromMinutes(5),
|
||||
QueuePollInterval = TimeSpan.Zero,
|
||||
UseRecommendedIsolationLevel = true
|
||||
});
|
||||
```
|
||||
Reference in New Issue
Block a user