public static void Setup() { Dispatcher = new MessageDispatcher(new SqlEventStore(ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString)); CommandQueries = ReadModelFactory <CommandQueries>(); Dispatcher.ScanInstance(new ParticipantCommandHandlers(CommandQueries)); Dispatcher.ScanInstance(new ContingentCommandHandlers(CommandQueries)); Dispatcher.ScanInstance(new ScoresCommandHandlers(CommandQueries, Dispatcher)); //TODO: Refactor Dispatcher out of Handler Dispatcher.ScanInstance(new TournamentCommandHandlers(CommandQueries)); StatisticsQueries = ReadModelFactory <StatisticsQueries>(); ParticipantQueries = ReadModelFactory <ParticipantQueries>(); ParticipantProfileQueries = ReadModelFactory <ParticipantProfileQueries>(); ContingentViewQueries = ReadModelFactory <ContingentViewQueries>(); ContingentTravelPlanQueries = ReadModelFactory <ContingentTravelPlanQueries>(); ContingentPracticePlanQueries = ReadModelFactory <ContingentPracticePlanQueries>(); ReservationQueries = ReadModelFactory <ReservationQueries>(); ScheduleQueries = ReadModelFactory <ScheduleQueries>(); MatchQueries = ReadModelFactory <MatchQueries>(); StandingQueries = ReadModelFactory <StandingQueries>(); HighScoreQueries = ReadModelFactory <HighScoreQueries>(); ParticipantScoreQueries = ReadModelFactory <ParticipantScoreQueries>(); TeamScoreQueries = ReadModelFactory <TeamScoreQueries>(); TournamentQueries = ReadModelFactory <TournamentQueries>(); StepladderQueries = ReadModelFactory <StepladderQueries>(); }
public static void Setup() { ReadModelFolder = HttpContext.Current.Server.MapPath("~/App_Data/ReadModels/"); Dispatcher = new MessageDispatcher(new SqlEventStore(Properties.Settings.Default.DefaultConnection)); Dispatcher.ScanInstance(new ParticipantCommandHandlers(Dispatcher)); Dispatcher.ScanInstance(new ContingentCommandHandlers()); Dispatcher.ScanInstance(new ScoresCommandHandlers(Dispatcher)); ParticipantQueries = new ParticipantQueries(ReadModelFolder); Dispatcher.ScanInstance(ParticipantQueries); ParticipantProfileQueries = new ParticipantProfileQueries(ReadModelFolder); Dispatcher.ScanInstance(ParticipantProfileQueries); ContingentQueries = new ContingentQueries(ReadModelFolder); Dispatcher.ScanInstance(ContingentQueries); ContingentViewQueries = new ContingentViewQueries(ReadModelFolder); Dispatcher.ScanInstance(ContingentViewQueries); ContingentTravelPlanQueries = new ContingentTravelPlanQueries(ReadModelFolder); Dispatcher.ScanInstance(ContingentTravelPlanQueries); ContingentPracticePlanQueries = new ContingentPracticePlanQueries(ReadModelFolder); Dispatcher.ScanInstance(ContingentPracticePlanQueries); ContingentEventHistoryQueries = new ContingentEventHistoryQueries(ReadModelFolder); Dispatcher.ScanInstance(ContingentEventHistoryQueries); ReservationQueries = new ReservationQueries(ReadModelFolder); Dispatcher.ScanInstance(ReservationQueries); ScheduleQueries = new ScheduleQueries(ReadModelFolder); Dispatcher.ScanInstance(ScheduleQueries); MatchQueries = new MatchQueries(ReadModelFolder); Dispatcher.ScanInstance(MatchQueries); StandingQueries = new StandingQueries(ReadModelFolder); Dispatcher.ScanInstance(StandingQueries); HighScoreQueries = new HighScoreQueries(ReadModelFolder); Dispatcher.ScanInstance(HighScoreQueries); ParticipantScoreQueries = new ParticipantScoreQueries(ReadModelFolder); Dispatcher.ScanInstance(ParticipantScoreQueries); TeamScoreQueries = new TeamScoreQueries(ReadModelFolder); Dispatcher.ScanInstance(TeamScoreQueries); if (!Directory.Exists(ReadModelFolder)) { RebuildReadModels(); } }