diff --git a/HangfireExample.sln b/HangfireExample.sln index c9438b5..9805579 100644 --- a/HangfireExample.sln +++ b/HangfireExample.sln @@ -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 diff --git a/HangfireExample/HangfireExample.csproj b/HangfireExample/HangfireExample.csproj index 2150e37..be3f0d1 100644 --- a/HangfireExample/HangfireExample.csproj +++ b/HangfireExample/HangfireExample.csproj @@ -7,4 +7,9 @@ enable + + + + + diff --git a/HangfireExample/Program.cs b/HangfireExample/Program.cs index 3751555..7cde91c 100644 --- a/HangfireExample/Program.cs +++ b/HangfireExample/Program.cs @@ -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"); + + + diff --git a/README.md b/README.md index 35b7fd2..7fb5e23 100644 --- a/README.md +++ b/README.md @@ -1 +1,70 @@ -# HangfireExample \ No newline at end of file +# Getting Started + +## Storage +Hangfire 會將所有相關資訊會被序列化後保存到儲存區,如類型、方法或參數等。 + +儲存模型官方預設有以下幾種 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Sql Server 2008+Redis 2.6.12+In-MemoryPrice
Openfree
Startup$500 / per year
Business$1,500 / per year
Enterprise$4,500 / per year
+ +資料來源日期: 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 + }); +``` \ No newline at end of file