Skip to content

Commit ee001e4

Browse files
committed
- file scoped namespaces
- simplified Program.cs - All update to latest - .NET 6 set as target framework - Package meta info update
1 parent d728215 commit ee001e4

34 files changed

Lines changed: 267 additions & 313 deletions

.vscode/settings.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"cSpell.words": [
3+
"Registrator"
4+
]
5+
}

CHANGELOG.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Changelog
2+
3+
## [0.4] - 2022-04-28
4+
5+
### Changed
6+
7+
- file scoped namespaces
8+
- simplified Program.cs
9+
10+
### Dependencies
11+
12+
- All update to latest
13+
- .NET 6 set as target framework

Simplify.ProjectsTemplates.csproj

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,22 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
3-
<TargetFramework>netcoreapp3.1</TargetFramework>
3+
<TargetFramework>net6.0</TargetFramework>
44

55
<PackageType>Template</PackageType>
6-
<PackageVersion>0.3.1</PackageVersion>
6+
<PackageVersion>0.4</PackageVersion>
77
<PackageId>Simplify.ProjectsTemplates</PackageId>
88
<IsPackable>true</IsPackable>
99
<PackageProjectUrl>https://github.com/SimplifyNet/Simplify.ProjectsTemplates</PackageProjectUrl>
1010
<PackageIconUrl>https://raw.githubusercontent.com/SimplifyNet/Images/master/Logo.png</PackageIconUrl>
1111
<RepositoryUrl>https://github.com/SimplifyNet/Simplify.ProjectsTemplates</RepositoryUrl>
1212
<RepositoryType>GIT</RepositoryType>
13-
<PackageReleaseNotes>
14-
Fixes
15-
LaunchSettings.json added
16-
Updates
17-
Expression-nody methods refactoring
18-
Comments improved
19-
</PackageReleaseNotes>
2013
<Title>Simplify project templates</Title>
2114
<Authors>Alexander Krylkov</Authors>
2215
<Description>Simplify libraries project templates collection.</Description>
2316
<Tags>templates;simplify</Tags>
2417

18+
<PackageReleaseNotes>See https://github.com/SimplifyNet/Simplify.Web/tree/master/src/Simplify.Web/CHANGELOG.md for details</PackageReleaseNotes>
19+
2520
<IncludeContentInPack>true</IncludeContentInPack>
2621
<IncludeBuildOutput>false</IncludeBuildOutput>
2722
<ContentTargetFolders>content</ContentTargetFolders>
@@ -30,4 +25,8 @@
3025
<Content Include="templates\**\*" Exclude="templates\**\bin\**;templates\**\obj\**" />
3126
<Compile Remove="**\*" />
3227
</ItemGroup>
28+
<ItemGroup>
29+
<None Include="images\icon.png" Pack="true" Visible="false" PackagePath="" />
30+
<None Include="CHANGELOG.md" Pack="true" PackagePath="\" />
31+
</ItemGroup>
3332
</Project>

images/icon.png

6.44 KB
Loading
Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
11
using System.Diagnostics;
22
using Simplify.Scheduler;
33

4-
namespace MyProject.Scheduler.Infrastructure
4+
namespace MyProject.Scheduler.Infrastructure;
5+
6+
public static class SchedulerHandlerObserver
57
{
6-
public static class SchedulerHandlerObserver
8+
public static MultitaskScheduler SubscribeLog(this MultitaskScheduler handler)
79
{
8-
public static MultitaskScheduler SubscribeLog(this MultitaskScheduler handler)
9-
{
10-
handler.OnException += OnException;
11-
12-
return handler;
13-
}
10+
handler.OnException += OnException;
1411

15-
private static void OnException(SchedulerExceptionArgs args) => Trace.WriteLine(args.Exception.Message);
12+
return handler;
1613
}
14+
15+
private static void OnException(SchedulerExceptionArgs args) => Trace.WriteLine(args.Exception.Message);
1716
}

templates/MyProject.Scheduler/MyProject.Scheduler.csproj

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
3-
<TargetFrameworks>netcoreapp3.1</TargetFrameworks>
4-
<LangVersion>9.0</LangVersion>
5-
<Version>0.1</Version>
6-
<Description>MyProject.Scheduler service</Description>
3+
<TargetFrameworks>net6.0</TargetFrameworks>
4+
<LangVersion>10.0</LangVersion>
75
<OutputType>Exe</OutputType>
6+
7+
<Description>MyProject.Scheduler service</Description>
88
</PropertyGroup>
99
<ItemGroup>
10-
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="3.1.*" />
11-
<PackageReference Include="Simplify.Scheduler" Version="1.1.*" />
10+
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="6.0.*" />
11+
<PackageReference Include="Simplify.Scheduler" Version="1.3.*" />
1212
</ItemGroup>
1313
<ItemGroup>
1414
<None Update="appsettings.json">
Lines changed: 14 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,21 @@
1-
using MyProject.Scheduler.Infrastructure;
1+
using MyProject.Scheduler;
2+
using MyProject.Scheduler.Infrastructure;
23
using MyProject.Scheduler.Setup;
34
using Simplify.DI;
45
using Simplify.Scheduler;
56

6-
namespace MyProject.Scheduler
7-
{
8-
internal class Program
9-
{
10-
private static void Main(string[] args)
11-
{
12-
//-:cnd:noEmit
13-
14-
#if DEBUG
15-
// Run debugger
16-
System.Diagnostics.Debugger.Launch();
17-
#endif
18-
//+:cnd:noEmit
7+
// IOC container setup
8+
DIContainer.Current
9+
.RegisterAll()
10+
.Verify();
1911

20-
// IOC container setup
21-
IocRegistrations.Register().Verify();
12+
using var scheduler = new SingleTaskScheduler<Worker>(IocRegistrations.Configuration)
13+
.SubscribeLog();
2214

23-
using var scheduler = new SingleTaskScheduler<Worker>(IocRegistrations.Configuration)
24-
.SubscribeLog();
25-
26-
if (!scheduler.Start(args))
27-
// One-time launch of user code without the scheduler
28-
RunAsAConsoleApplication();
29-
}
15+
if (!scheduler.Start(args))
16+
{
17+
// One-time launch of user code without the scheduler
3018

31-
private static void RunAsAConsoleApplication()
32-
{
33-
using var scope = DIContainer.Current.BeginLifetimeScope();
34-
scope.Resolver.Resolve<Worker>().Run();
35-
}
36-
}
37-
}
19+
using var scope = DIContainer.Current.BeginLifetimeScope();
20+
scope.Resolver.Resolve<Worker>().Run();
21+
}

templates/MyProject.Scheduler/Setup/IocRegistrations.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@ public static class IocRegistrations
77
{
88
public static IConfiguration Configuration { get; private set; }
99

10-
public static IDIContainerProvider Register()
10+
public static IDIContainerProvider RegisterAll(this IDIContainerProvider provider)
1111
{
12-
DIContainer.Current.RegisterConfiguration()
12+
provider.RegisterConfiguration()
1313
.Register<Worker>();
1414

15-
return DIContainer.Current;
15+
return provider;
1616
}
1717

1818
private static IDIRegistrator RegisterConfiguration(this IDIRegistrator registrator)
Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,8 @@
11
using System.Diagnostics;
22

3-
namespace MyProject.Scheduler
3+
namespace MyProject.Scheduler;
4+
5+
internal class Worker
46
{
5-
internal class Worker
6-
{
7-
public void Run()
8-
{
9-
Trace.WriteLine("Hello world!");
10-
}
11-
}
7+
public void Run() => Trace.WriteLine("Hello world!");
128
}
Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
11
using System.Diagnostics;
22
using Simplify.WindowsServices;
33

4-
namespace MyProject.WindowsService.Infrastructure
4+
namespace MyProject.WindowsService.Infrastructure;
5+
6+
public static class WindowsServiceHandlerObserver
57
{
6-
public static class WindowsServiceHandlerObserver
8+
public static MultitaskServiceHandler SubscribeLog(this MultitaskServiceHandler handler)
79
{
8-
public static MultitaskServiceHandler SubscribeLog(this MultitaskServiceHandler handler)
9-
{
10-
handler.OnException += OnException;
11-
12-
return handler;
13-
}
10+
handler.OnException += OnException;
1411

15-
private static void OnException(ServiceExceptionArgs args) => Trace.WriteLine(args.Exception.Message);
12+
return handler;
1613
}
14+
15+
private static void OnException(ServiceExceptionArgs args) => Trace.WriteLine(args.Exception.Message);
1716
}

0 commit comments

Comments
 (0)