File tree Expand file tree Collapse file tree 2 files changed +28
-0
lines changed
RealTimeWeatherMonitoringApp/Infrastructure Expand file tree Collapse file tree 2 files changed +28
-0
lines changed Original file line number Diff line number Diff line change 1+ using RealTimeWeatherMonitoringApp . Domain . Models ;
2+
3+ namespace RealTimeWeatherMonitoringApp . Infrastructure . Interfaces ;
4+
5+ /// <typeparam name="TEvaluated">Determines the type of bots to initialize, and what data they evaluate</typeparam>
6+ public interface IBotInitializer < TEvaluated >
7+ {
8+ IEnumerable < Bot < TEvaluated > > InitializeAndGetAllBots ( ) ;
9+ }
Original file line number Diff line number Diff line change 1+ using RealTimeWeatherMonitoringApp . Domain . Models ;
2+ using RealTimeWeatherMonitoringApp . Infrastructure . Interfaces ;
3+ using RealTimeWeatherMonitoringApp . Infrastructure . Interfaces . Factory ;
4+
5+ namespace RealTimeWeatherMonitoringApp . Infrastructure . Service ;
6+
7+ public class BotInitializer < TEvaluated > : IBotInitializer < TEvaluated >
8+ {
9+ private readonly Lazy < IEnumerable < Bot < TEvaluated > > > _bots ;
10+
11+ public BotInitializer ( IConfigurationFactory configurationFactory , IBotFactory < TEvaluated > botFactory )
12+ {
13+ _bots = new Lazy < IEnumerable < Bot < TEvaluated > > > ( ( ) => configurationFactory
14+ . CreateBotConfigurations ( )
15+ . Select ( botFactory . CreateBot ) ) ;
16+ }
17+
18+ public IEnumerable < Bot < TEvaluated > > InitializeAndGetAllBots ( ) => _bots . Value ;
19+ }
You can’t perform that action at this time.
0 commit comments