Skip to content

Commit b639eb5

Browse files
committed
[r] scheduler with database name
1 parent 6abeea9 commit b639eb5

32 files changed

+96
-95
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ dotnet new -i Simplify.ProjectsTemplates
1717
| :---------------------- | :---------------------- |
1818
| Simplify.Scheduler | simplify.scheduler |
1919
| Simplify.WindowsService | simplify.windowsservice |
20+
| Simplify.SchedulerWithDatabase | simplify.schedulerwithdatabase |
2021

2122
## Project creation example
2223

src/templates/MyProjectWindowsServiceWithDatabase/.template.config/template.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@
66
"Simplify"
77
],
88
"name": "Simplify.Scheduler console scheduler with domain and persistance layer",
9-
"identity": "Simplify.Template.WindowsService",
10-
"shortName": "simplify.windowsservicewithdatabase",
9+
"identity": "Simplify.Template.SchedulerWithDatabase",
10+
"shortName": "simplify.schedulerwithdatabase",
1111
"tags": {
1212
"language": "C#",
1313
"type": "project"
1414
},
15-
"sourceName": "MyProjectWindowsServiceWithDatabase"
15+
"sourceName": "MyProjectSchedulerWithDatabase"
1616
}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
using NUnit.Framework;
33
using Simplify.FluentNHibernate;
44

5-
namespace MyProjectWindowsServiceWithDatabase.Database.SchemaUpdater.Dangerous;
5+
namespace MyProjectSchedulerWithDatabase.Database.SchemaUpdater.Dangerous;
66

77
[TestFixture]
88
[Category("Integration")]
@@ -15,7 +15,7 @@ public void UpdateSchema()
1515
.AddJsonFile("appsettings.json", false)
1616
.Build();
1717

18-
new MyProjectWindowsServiceWithDatabaseSessionFactoryBuilder(cfg)
18+
new MyProjectSchedulerWithDatabaseSessionFactoryBuilder(cfg)
1919
.CreateConfiguration()
2020
.UpdateSchema(x => x.CreateIndexesForForeignKeys());
2121
}
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
<TargetFramework>net7.0</TargetFramework>
44
<LangVersion>latest</LangVersion>
55

6-
<Description>MyProjectWindowsServiceWithDatabase.Database integration tests</Description>
7-
<Product>MyProjectWindowsServiceWithDatabase</Product>
6+
<Description>MyProjectSchedulerWithDatabase.Database integration tests</Description>
7+
<Product>MyProjectSchedulerWithDatabase</Product>
88
</PropertyGroup>
99
<ItemGroup>
10-
<ProjectReference Include="..\MyProjectWindowsServiceWithDatabase.Database\MyProjectWindowsServiceWithDatabase.Database.csproj" />
10+
<ProjectReference Include="..\MyProjectSchedulerWithDatabase.Database\MyProjectSchedulerWithDatabase.Database.csproj" />
1111
</ItemGroup>
1212
<ItemGroup>
1313
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="7.0.*" />
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
using MyProjectSchedulerWithDatabase.Database.MyEntities;
2+
using Simplify.Repository.FluentNHibernate.Mappings;
3+
4+
namespace MyProjectSchedulerWithDatabase.Database.Mappings;
5+
6+
public class MyEntityMap : IdentityObjectMap<MyEntity>
7+
{
8+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
using MyProjectSchedulerWithDatabase.MyEntities;
2+
using Simplify.Repository.FluentNHibernate;
3+
4+
namespace MyProjectSchedulerWithDatabase.Database.MyEntities;
5+
6+
public class MyEntity : IdentityObject, IMyEntity
7+
{
8+
}
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
<TargetFramework>net7.0</TargetFramework>
44
<LangVersion>latest</LangVersion>
55

6-
<Description>MyProjectWindowsServiceWithDatabase database implementation</Description>
7-
<Product>MyProjectWindowsServiceWithDatabase</Product>
6+
<Description>MyProjectSchedulerWithDatabase database implementation</Description>
7+
<Product>MyProjectSchedulerWithDatabase</Product>
88
</PropertyGroup>
99
<ItemGroup>
10-
<ProjectReference Include="..\MyProjectWindowsServiceWithDatabase\MyProjectWindowsServiceWithDatabase.csproj" />
10+
<ProjectReference Include="..\MyProjectSchedulerWithDatabase\MyProjectSchedulerWithDatabase.csproj" />
1111
</ItemGroup>
1212
<ItemGroup>
1313
<PackageReference Include="Simplify.DI" Version="4.2.*" />
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,18 @@
55
using Simplify.FluentNHibernate.Conventions;
66
using Simplify.Repository.FluentNHibernate;
77

8-
namespace MyProjectWindowsServiceWithDatabase.Database;
8+
namespace MyProjectSchedulerWithDatabase.Database;
99

10-
public class MyProjectWindowsServiceWithDatabaseSessionFactoryBuilder : SessionFactoryBuilderBase
10+
public class MyProjectSchedulerWithDatabaseSessionFactoryBuilder : SessionFactoryBuilderBase
1111
{
12-
public MyProjectWindowsServiceWithDatabaseSessionFactoryBuilder(IConfiguration configuration)
13-
: base(configuration, "MyProjectWindowsServiceWithDatabaseDatabaseConnectionSettings")
12+
public MyProjectSchedulerWithDatabaseSessionFactoryBuilder(IConfiguration configuration)
13+
: base(configuration, "MyProjectSchedulerWithDatabaseDatabaseConnectionSettings")
1414
{
1515
}
1616

1717
public override FluentConfiguration CreateConfiguration() =>
1818
FluentConfiguration.InitializeFromConfigMsSql(Configuration, ConfigSectionName)
19-
.AddMappingsFromAssemblyOf<MyProjectWindowsServiceWithDatabaseSessionFactoryBuilder>(PrimaryKey.Name.Is(x => "ID"),
19+
.AddMappingsFromAssemblyOf<MyProjectSchedulerWithDatabaseSessionFactoryBuilder>(PrimaryKey.Name.Is(x => "ID"),
2020
Table.Is(x => x.EntityType.Name + "s"),
2121
ForeignKey.EndsWith("ID"),
2222
ForeignKeyConstraintNameConvention.WithConstraintNameConvention());
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
using NHibernate;
2+
using Simplify.Repository.FluentNHibernate;
3+
4+
namespace MyProjectSchedulerWithDatabase.Database;
5+
6+
public class MyProjectSchedulerWithDatabaseUnitOfWork : TransactUnitOfWork, IMyProjectSchedulerWithDatabaseUnitOfWork
7+
{
8+
public MyProjectSchedulerWithDatabaseUnitOfWork(ISessionFactory sessionFactory) : base(sessionFactory)
9+
{
10+
}
11+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
using Microsoft.Extensions.Configuration;
2+
using MyProjectSchedulerWithDatabase.MyEntities;
3+
using Simplify.DI;
4+
using Simplify.Repository.FluentNHibernate;
5+
6+
namespace MyProjectSchedulerWithDatabase.Database.Setup;
7+
8+
public static class SimplifyDIRegistratorExtensions
9+
{
10+
public static IDIRegistrator RegisterMyProjectSchedulerWithDatabase(this IDIRegistrator registrator) =>
11+
registrator.Register(
12+
r => (MyProjectSchedulerWithDatabaseSessionFactoryBuilder)new MyProjectSchedulerWithDatabaseSessionFactoryBuilder(
13+
r.Resolve<IConfiguration>()).Build(), LifetimeType.Singleton)
14+
.Register(r => new MyProjectSchedulerWithDatabaseUnitOfWork(r.Resolve<MyProjectSchedulerWithDatabaseSessionFactoryBuilder>()
15+
.Instance))
16+
.Register<IMyProjectSchedulerWithDatabaseUnitOfWork>(r => r.Resolve<MyProjectSchedulerWithDatabaseUnitOfWork>())
17+
.Register(r => r.Resolve<MyProjectSchedulerWithDatabaseUnitOfWork>().Session)
18+
19+
.RegisterTransactRepository<IMyEntity, IMyProjectSchedulerWithDatabaseUnitOfWork>()
20+
.Register<IMyEntityServiceService, MyEntityService>();
21+
}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
# Parameters
22

3-
$appName = "MyProjectWindowsServiceWithDatabase"
3+
$appName = "MyProjectSchedulerWithDatabase"
44
$appPath = $PSScriptRoot
55
$exepath = $appPath + "\" + $appName + ".exe"
6-
$description = "MyProjectWindowsServiceWithDatabase service"
6+
$description = "MyProjectSchedulerWithDatabase service"
77
$stopTimeout = 150000 # 5 minutes
88
$logonUser = "LocalService"
99

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55
<Platforms>x64</Platforms>
66
<OutputType>Exe</OutputType>
77

8-
<Description>MyProjectWindowsServiceWithDatabase service</Description>
9-
<Product>MyProjectWindowsServiceWithDatabase</Product>
8+
<Description>MyProjectSchedulerWithDatabase service</Description>
9+
<Product>MyProjectSchedulerWithDatabase</Product>
1010
</PropertyGroup>
1111
<ItemGroup>
12-
<ProjectReference Include="..\MyProjectWindowsServiceWithDatabase.Database\MyProjectWindowsServiceWithDatabase.Database.csproj" />
12+
<ProjectReference Include="..\MyProjectSchedulerWithDatabase.Database\MyProjectSchedulerWithDatabase.Database.csproj" />
1313
</ItemGroup>
1414
<ItemGroup>
1515
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="7.0.*" />
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
using MyProject.Scheduler.Infrastructure;
2-
using MyProjectWindowsServiceWithDatabase.Service;
3-
using MyProjectWindowsServiceWithDatabase.Service.Setup;
2+
using MyProjectSchedulerWithDatabase.Service;
3+
using MyProjectSchedulerWithDatabase.Service.Setup;
44
using Simplify.DI;
55
using Simplify.Scheduler;
66

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"profiles": {
3-
"MyProjectWindowsServiceWithDatabase": {
3+
"MyProjectSchedulerWithDatabase": {
44
"commandName": "Project"
55
}
66
}
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
using Microsoft.Extensions.Configuration;
2-
using MyProjectWindowsServiceWithDatabase.Database.Setup;
2+
using MyProjectSchedulerWithDatabase.Database.Setup;
33
using Simplify.DI;
44

5-
namespace MyProjectWindowsServiceWithDatabase.Service.Setup;
5+
namespace MyProjectSchedulerWithDatabase.Service.Setup;
66

77
public static class IocRegistrations
88
{
@@ -11,7 +11,7 @@ public static class IocRegistrations
1111
public static IDIContainerProvider RegisterAll(this IDIContainerProvider provider)
1212
{
1313
provider.RegisterConfiguration()
14-
.RegisterMyProjectWindowsServiceWithDatabase()
14+
.RegisterMyProjectSchedulerWithDatabase()
1515
.Register<Worker>();
1616

1717
return provider;
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
using System.Threading.Tasks;
2-
using MyProjectWindowsServiceWithDatabase.MyEntities;
2+
using MyProjectSchedulerWithDatabase.MyEntities;
33

4-
namespace MyProjectWindowsServiceWithDatabase.Service;
4+
namespace MyProjectSchedulerWithDatabase.Service;
55

66
internal class Worker
77
{
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"MyProjectWindowsServiceWithDatabaseDatabaseConnectionSettings": {
2+
"MyProjectSchedulerWithDatabaseDatabaseConnectionSettings": {
33
"ServerName": "",
44
"UserName": "",
55
"UserPassword": "",
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"ServiceSettings": {
33
"CrontabExpression": "* * * * *"
44
},
5-
"MyProjectWindowsServiceWithDatabaseDatabaseConnectionSettings": {
5+
"MyProjectSchedulerWithDatabaseDatabaseConnectionSettings": {
66
"ServerName": "",
77
"DataBaseName": "",
88
"UserName": "",

src/templates/MyProjectWindowsServiceWithDatabase/MyProjectWindowsServiceWithDatabase.sln renamed to src/templates/MyProjectWindowsServiceWithDatabase/MyProjectSchedulerWithDatabase.sln

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@ Microsoft Visual Studio Solution File, Format Version 12.00
33
# Visual Studio Version 16
44
VisualStudioVersion = 16.0.31019.35
55
MinimumVisualStudioVersion = 10.0.40219.1
6-
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MyProjectWindowsServiceWithDatabase.Service", "MyProjectWindowsServiceWithDatabase.Service\MyProjectWindowsServiceWithDatabase.Service.csproj", "{74EA86C6-ECF6-4848-9578-A4A40D3C5AFD}"
6+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MyProjectSchedulerWithDatabase.Service", "MyProjectSchedulerWithDatabase.Service\MyProjectSchedulerWithDatabase.Service.csproj", "{74EA86C6-ECF6-4848-9578-A4A40D3C5AFD}"
77
EndProject
8-
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MyProjectWindowsServiceWithDatabase", "MyProjectWindowsServiceWithDatabase\MyProjectWindowsServiceWithDatabase.csproj", "{C3826D09-5DA8-4DA2-A49A-4D32D9E3914B}"
8+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MyProjectSchedulerWithDatabase", "MyProjectSchedulerWithDatabase\MyProjectSchedulerWithDatabase.csproj", "{C3826D09-5DA8-4DA2-A49A-4D32D9E3914B}"
99
EndProject
10-
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MyProjectWindowsServiceWithDatabase.Database", "MyProjectWindowsServiceWithDatabase.Database\MyProjectWindowsServiceWithDatabase.Database.csproj", "{285852CE-3367-453B-B156-7DDEF1FA6643}"
10+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MyProjectSchedulerWithDatabase.Database", "MyProjectSchedulerWithDatabase.Database\MyProjectSchedulerWithDatabase.Database.csproj", "{285852CE-3367-453B-B156-7DDEF1FA6643}"
1111
EndProject
12-
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MyProjectWindowsServiceWithDatabase.Database.SchemaUpdater", "MyProjectWindowsServiceWithDatabase.Database.SchemaUpdater\MyProjectWindowsServiceWithDatabase.Database.SchemaUpdater.csproj", "{DA774F29-D22B-416F-B92D-F1C795DFF8FD}"
12+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MyProjectSchedulerWithDatabase.Database.SchemaUpdater", "MyProjectSchedulerWithDatabase.Database.SchemaUpdater\MyProjectSchedulerWithDatabase.Database.SchemaUpdater.csproj", "{DA774F29-D22B-416F-B92D-F1C795DFF8FD}"
1313
EndProject
1414
Global
1515
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
using Simplify.Repository;
2+
3+
namespace MyProjectSchedulerWithDatabase;
4+
5+
public interface IMyProjectSchedulerWithDatabaseUnitOfWork : ITransactUnitOfWork
6+
{
7+
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
using Simplify.Repository;
22

3-
namespace MyProjectWindowsServiceWithDatabase.MyEntities;
3+
namespace MyProjectSchedulerWithDatabase.MyEntities;
44

55
public interface IMyEntity : IIdentityObject
66
{
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
using System.Collections.Generic;
22
using System.Threading.Tasks;
33

4-
namespace MyProjectWindowsServiceWithDatabase.MyEntities;
4+
namespace MyProjectSchedulerWithDatabase.MyEntities;
55

66
public interface IMyEntityServiceService
77
{
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
using System.Threading.Tasks;
33
using Simplify.Repository;
44

5-
namespace MyProjectWindowsServiceWithDatabase.MyEntities;
5+
namespace MyProjectSchedulerWithDatabase.MyEntities;
66

77
public class MyEntityService : IMyEntityServiceService
88
{
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
<TargetFramework>net7.0</TargetFramework>
44
<LangVersion>latest</LangVersion>
55

6-
<Description>MyProjectWindowsServiceWithDatabase domain library</Description>
7-
<Product>MyProjectWindowsServiceWithDatabase</Product>
6+
<Description>MyProjectSchedulerWithDatabase domain library</Description>
7+
<Product>MyProjectSchedulerWithDatabase</Product>
88
</PropertyGroup>
99
<ItemGroup>
1010
<PackageReference Include="Simplify.Repository" Version="1.6.1" />

src/templates/MyProjectWindowsServiceWithDatabase/MyProjectWindowsServiceWithDatabase.Database/Mappings/MyEntityMap.cs

Lines changed: 0 additions & 8 deletions
This file was deleted.

src/templates/MyProjectWindowsServiceWithDatabase/MyProjectWindowsServiceWithDatabase.Database/MyEntities/MyEntity.cs

Lines changed: 0 additions & 8 deletions
This file was deleted.

src/templates/MyProjectWindowsServiceWithDatabase/MyProjectWindowsServiceWithDatabase.Database/MyProjectWindowsServiceWithDatabaseUnitOfWork.cs

Lines changed: 0 additions & 11 deletions
This file was deleted.

src/templates/MyProjectWindowsServiceWithDatabase/MyProjectWindowsServiceWithDatabase.Database/Setup/SimplifyDIRegistratorExtensions.cs

Lines changed: 0 additions & 21 deletions
This file was deleted.

src/templates/MyProjectWindowsServiceWithDatabase/MyProjectWindowsServiceWithDatabase/IMyProjectWindowsServiceWithDatabaseUnitOfWork.cs

Lines changed: 0 additions & 7 deletions
This file was deleted.

0 commit comments

Comments
 (0)