File tree Expand file tree Collapse file tree 2 files changed +34
-0
lines changed
RealTimeWeatherMonitoringApp/Infrastructure Expand file tree Collapse file tree 2 files changed +34
-0
lines changed Original file line number Diff line number Diff line change 1+ using RealTimeWeatherMonitoringApp . Domain . Models ;
2+ using RealTimeWeatherMonitoringApp . Infrastructure . Configuration ;
3+ using RealTimeWeatherMonitoringApp . Infrastructure . Extension ;
4+ using RealTimeWeatherMonitoringApp . Infrastructure . Interfaces . Factory ;
5+
6+ namespace RealTimeWeatherMonitoringApp . Infrastructure . Factory ;
7+
8+ public class BotFactory < TEvaluated > : IBotFactory < TEvaluated >
9+ {
10+ private readonly IEvaluatorFactory < TEvaluated > _evaluatorFactory ;
11+ public BotFactory ( IEvaluatorFactory < TEvaluated > evaluatorFactory ) => _evaluatorFactory = evaluatorFactory ;
12+
13+ public Bot < TEvaluated > CreateBot ( BotConfiguration configuration )
14+ {
15+ var evaluator = configuration . Conditions
16+ . Select ( config => _evaluatorFactory . CreateEvaluator ( config ) )
17+ . EvaluateAll ( ) ;
18+
19+ return new Bot < TEvaluated > (
20+ configuration . Name ,
21+ configuration . Enabled ,
22+ configuration . Message ,
23+ evaluator ) ;
24+ }
25+ }
Original file line number Diff line number Diff line change 1+ using RealTimeWeatherMonitoringApp . Domain . Models ;
2+ using RealTimeWeatherMonitoringApp . Infrastructure . Configuration ;
3+
4+ namespace RealTimeWeatherMonitoringApp . Infrastructure . Interfaces . Factory ;
5+
6+ public interface IBotFactory < TEvaluated >
7+ {
8+ Bot < TEvaluated > CreateBot ( BotConfiguration configuration ) ;
9+ }
You can’t perform that action at this time.
0 commit comments