Skip to content

Commit b1d519b

Browse files
committed
Dependencies upgraded to 1.0.0 RTM
1 parent 3d962d9 commit b1d519b

File tree

8 files changed

+5311
-4978
lines changed

8 files changed

+5311
-4978
lines changed

README.md

Lines changed: 36 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -6,55 +6,60 @@ Each task is a separate `Task`, which sleeps in background for a while, wakes up
66

77
Ideal, when you don't need to run many/heavy tasks and don't want to use "big" solutions with persistence and other bells and whistles.
88

9-
Written for **ASP.NET vNext** (ASP.NET 5, ASP.NET Core 1).
9+
Written for **ASP.NET Core** (ASP.NET 5, ASP.NET vNext).
1010

1111
## Main features
1212

13-
* Start and Stop you task at any time;
13+
* Start and Stop your task at any time;
1414
* First run (after Start) is delayed at random value (10-30 sec, customizable) to prevent app freeze during statup;
1515
* Run "immediately" (without waiting for next scheduled time);
1616
* Change run interval while running;
1717
* `RunStatus` property (extendable) contains:
18-
* last/next run times;
19-
* last run result (success / exception);
20-
* last success run time;
21-
* last exception;
22-
* total failed runs counter.
18+
* last/next run times;
19+
* last run result (success / exception);
20+
* last success run time;
21+
* last exception;
22+
* total failed runs counter.
2323

2424
## Usage
2525

2626
### 1. Create new task class
2727

28-
public class MyFirstTask : TaskBase<TaskRunStatus>
28+
```csharp
29+
public class MyFirstTask : TaskBase<TaskRunStatus>
30+
{
31+
public MyFirstTask(ILoggerFactory loggerFactory, IServiceScopeFactory serviceScopeFactory)
32+
: base(loggerFactory, TimeSpan.FromMinutes(5), serviceScopeFactory)
2933
{
30-
public MyFirstTask(ILoggerFactory loggerFactory, IServiceScopeFactory serviceScopeFactory)
31-
: base(loggerFactory, TimeSpan.FromMinutes(5), serviceScopeFactory)
32-
{
33-
// Nothing
34-
}
34+
// Nothing
35+
}
3536

36-
protected override void Run(IServiceProvider serviceProvider, TaskRunStatus runStatus)
37-
{
37+
protected override void Run(IServiceProvider serviceProvider, TaskRunStatus runStatus)
38+
{
3839
// Place your code here
39-
}
4040
}
41+
}
42+
```
4143

4244
### 2. Register and start your task in `Startup.cs`
4345

44-
public void ConfigureServices(IServiceCollection services)
45-
{
46-
...
47-
services.AddSingleton<MyFirstTask>();
48-
...
49-
}
46+
47+
```csharp
48+
public void ConfigureServices(IServiceCollection services)
49+
{
50+
...
51+
services.AddSingleton<MyFirstTask>();
52+
...
53+
}
5054

51-
public void Configure(IApplicationBuilder app, ...)
52-
{
53-
...
54-
app.ApplicationServices.GetRequiredService<MyFirstTask>().Start();
55-
...
56-
}
57-
55+
public void Configure(IApplicationBuilder app, ...)
56+
{
57+
...
58+
app.ApplicationServices.GetRequiredService<MyFirstTask>().Start();
59+
...
60+
}
61+
```
62+
5863
And viola! Your task will run every 5 minutes (second param when calling :base constructor). Until you application alive, of course.
5964

6065

@@ -72,6 +77,8 @@ Target [framework/platform moniker](https://github.com/dotnet/corefx/blob/master
7277

7378
## Version history
7479

80+
* 2.3.0 (June 28, 2016)
81+
* Dependencies upgraded to 1.0.0 RTM
7582
* 2.2.0 (May 24, 2016)
7683
* New `AfterRunFail` event with `Exception` info
7784
* 2.1.0 (May 17, 2016)

global.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"projects": [ "src", "test" ],
33
"sdk": {
4-
"version": "1.0.0-preview1-002702"
4+
"version": "1.0.0-preview2-003121"
55
}
66
}

sample/RecurrentTasks.Sample/project.json

Lines changed: 11 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,41 +3,33 @@
33

44
"dependencies": {
55
"Microsoft.NETCore.App": {
6-
"version": "1.0.0-rc2-3002702",
6+
"version": "1.0.0",
77
"type": "platform"
88
},
9-
"Microsoft.AspNetCore.Server.IISIntegration": "1.0.0-rc2-final",
10-
"Microsoft.AspNetCore.Server.Kestrel": "1.0.0-rc2-final",
11-
"Microsoft.AspNetCore.Mvc": "1.0.0-rc2-final",
9+
"Microsoft.AspNetCore.Server.IISIntegration": "1.0.0",
10+
"Microsoft.AspNetCore.Server.Kestrel": "1.0.0",
11+
"Microsoft.AspNetCore.Mvc": "1.0.0",
1212
"Microsoft.AspNetCore.Razor.Tools": {
13-
"version": "1.0.0-preview1-final",
13+
"version": "1.0.0-preview2-final",
1414
"type": "build"
1515
},
16-
"Microsoft.Extensions.Configuration": "1.0.0-rc2-final",
17-
"Microsoft.Extensions.Logging": "1.0.0-rc2-final",
18-
"Microsoft.Extensions.Logging.Console": "1.0.0-rc2-final",
16+
"Microsoft.Extensions.Configuration": "1.0.0",
17+
"Microsoft.Extensions.Logging": "1.0.0",
18+
"Microsoft.Extensions.Logging.Console": "1.0.0",
1919
"RecurrentTasks": "*"
2020
},
2121

2222
"tools": {
2323
"Microsoft.AspNetCore.Razor.Tools": {
24-
"version": "1.0.0-preview1-final",
25-
"imports": "portable-net45+win8+dnxcore50"
24+
"version": "1.0.0-preview2-final"
2625
},
2726
"Microsoft.AspNetCore.Server.IISIntegration.Tools": {
28-
"version": "1.0.0-preview1-final",
29-
"imports": "portable-net45+win8+dnxcore50"
27+
"version": "1.0.0-preview2-final"
3028
}
3129
},
3230

3331
"frameworks": {
34-
"netcoreapp1.0": {
35-
"imports": [
36-
"dotnet5.6",
37-
"dnxcore50",
38-
"portable-net45+win8"
39-
]
40-
}
32+
"netcoreapp1.0": {}
4133
},
4234
"buildOptions": {
4335
"emitEntryPoint": true,

0 commit comments

Comments
 (0)