-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #59 from marcwittke/release/5.1.0
Release/5.1.0
- Loading branch information
Showing
18 changed files
with
249 additions
and
138 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 0 additions & 63 deletions
63
src/abstractions/Backend.Fx/Environment/MultiTenancy/TenantDataGenerator.cs
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
src/abstractions/Backend.Fx/Patterns/DataGeneration/DataGeneratorContext.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
namespace Backend.Fx.Patterns.DataGeneration | ||
{ | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using Logging; | ||
using Patterns.UnitOfWork; | ||
|
||
public class DataGeneratorContext | ||
{ | ||
private static readonly ILogger Logger = LogManager.Create<DataGeneratorContext>(); | ||
private readonly IEnumerable<IDataGenerator> _dataGenerators; | ||
private readonly ICanFlush _canFlush; | ||
|
||
public DataGeneratorContext(IEnumerable<IDataGenerator> dataGenerators, ICanFlush canFlush) | ||
{ | ||
_dataGenerators = dataGenerators; | ||
_canFlush = canFlush; | ||
} | ||
|
||
public void RunProductiveDataGenerators() | ||
{ | ||
Logger.Info("Loading productive data into database"); | ||
RunDataGenerators<IProductiveDataGenerator>(); | ||
} | ||
|
||
public void RunDemoDataGenerators() | ||
{ | ||
Logger.Info("Loading demonstration data into database"); | ||
RunDataGenerators<IDemoDataGenerator>(); | ||
} | ||
|
||
private void RunDataGenerators<TDataGenerator>() | ||
{ | ||
foreach (var dataGenerator in _dataGenerators.Where(dg => dg is TDataGenerator).OrderBy(dg => dg.Priority)) | ||
{ | ||
dataGenerator.Generate(); | ||
_canFlush.Flush(); | ||
} | ||
} | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
src/abstractions/Backend.Fx/Patterns/DataGeneration/DemoDataGenerationJob.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
using System.Collections.Generic; | ||
using Backend.Fx.Patterns.Jobs; | ||
using Backend.Fx.Patterns.UnitOfWork; | ||
|
||
namespace Backend.Fx.Patterns.DataGeneration | ||
{ | ||
public class DemoDataGenerationJob : IJob | ||
{ | ||
private readonly IEnumerable<IDataGenerator> _dataGenerators; | ||
private readonly ICanFlush _canFlush; | ||
|
||
public DemoDataGenerationJob(IEnumerable<IDataGenerator> dataGenerators, ICanFlush canFlush) | ||
{ | ||
_dataGenerators = dataGenerators; | ||
_canFlush = canFlush; | ||
} | ||
|
||
public void Run() | ||
{ | ||
var dataGeneratorContext = new DataGeneratorContext(_dataGenerators, _canFlush); | ||
dataGeneratorContext.RunProductiveDataGenerators(); | ||
dataGeneratorContext.RunDemoDataGenerators(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
src/abstractions/Backend.Fx/Patterns/DataGeneration/ProdDataGenerationJob.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
using System.Collections.Generic; | ||
using Backend.Fx.Patterns.Jobs; | ||
using Backend.Fx.Patterns.UnitOfWork; | ||
|
||
namespace Backend.Fx.Patterns.DataGeneration | ||
{ | ||
public class ProdDataGenerationJob : IJob | ||
{ | ||
private readonly IEnumerable<IDataGenerator> _dataGenerators; | ||
private readonly ICanFlush _canFlush; | ||
|
||
public ProdDataGenerationJob(IEnumerable<IDataGenerator> dataGenerators, ICanFlush canFlush) | ||
{ | ||
_dataGenerators = dataGenerators; | ||
_canFlush = canFlush; | ||
} | ||
|
||
public void Run() | ||
{ | ||
var dataGeneratorContext = new DataGeneratorContext(_dataGenerators, _canFlush); | ||
dataGeneratorContext.RunProductiveDataGenerators(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.