File tree Expand file tree Collapse file tree 2 files changed +38
-0
lines changed
RealTimeWeatherMonitoringApp/Domain Expand file tree Collapse file tree 2 files changed +38
-0
lines changed Original file line number Diff line number Diff line change 1+ namespace RealTimeWeatherMonitoringApp . Domain . Interfaces . Service ;
2+
3+ public interface IBotControllerService < TEvaluated >
4+ {
5+ IEnumerable < IBotController < TEvaluated > > GetBotControllers ( ) ;
6+
7+ /// <summary>
8+ /// Attaches the bot controllers to the given publishing service before fetching them.
9+ /// </summary>
10+ /// <param name="publishingService">A publishing service that will receive all bot controllers events</param>
11+ /// <returns>A collection of bot controllers attached to the given publishing service</returns>
12+ IEnumerable < IBotController < TEvaluated > > GetBotControllers ( IBotPublishingService publishingService ) ;
13+ }
Original file line number Diff line number Diff line change 1+ using RealTimeWeatherMonitoringApp . Domain . Interfaces ;
2+ using RealTimeWeatherMonitoringApp . Domain . Interfaces . Repository ;
3+ using RealTimeWeatherMonitoringApp . Domain . Interfaces . Service ;
4+ using RealTimeWeatherMonitoringApp . Domain . Models . Controller ;
5+
6+ namespace RealTimeWeatherMonitoringApp . Domain . Service ;
7+
8+ public class BotControllerService < TEvaluated > : IBotControllerService < TEvaluated >
9+ {
10+ private readonly Lazy < IEnumerable < BotController < TEvaluated > > > _botControllers ;
11+
12+ public BotControllerService ( IBotRepository < TEvaluated > repository )
13+ {
14+ _botControllers = new Lazy < IEnumerable < BotController < TEvaluated > > > ( ( ) =>
15+ repository . GetAll ( ) . Select ( b => new BotController < TEvaluated > ( b ) ) ) ;
16+ }
17+
18+ public IEnumerable < IBotController < TEvaluated > > GetBotControllers ( ) => _botControllers . Value ;
19+
20+ public IEnumerable < IBotController < TEvaluated > > GetBotControllers ( IBotPublishingService publishingService )
21+ {
22+ return _botControllers . Value . Select ( botController =>
23+ new PublisherBotController < TEvaluated > ( botController , publishingService ) ) ;
24+ }
25+ }
You can’t perform that action at this time.
0 commit comments