Exemplo n.º 1
0
 public PossiblyOffStatus(IStreamStatusContext context, IQueryCommandService <IUnitOfWork> unitOfWork, ITimeService timeService, ISettings settings)
 {
     _context     = context;
     _unitOfWork  = unitOfWork;
     _timeService = timeService;
     _settings    = settings;
 }
 /// <summary>
 /// Executes the given commands in sequence and returns total number of objects written to the underlying database.
 /// </summary>
 /// <typeparam name="TContext"></typeparam>
 /// <param name="dbService">The instance of the interface on which this extension method is defined.</param>
 /// <param name="commands">The sequence of commands of execute.</param>
 /// <returns>The total number of objects written to the underlying database from all of the given <paramref name="commands"/>.</returns>
 public static int Command <TContext>(this IQueryCommandService <TContext> dbService, params Action <TContext>[] commands)
     where TContext : IDisposable, ISavable =>
 dbService.Command(db => commands
                   .Where(cmd => cmd != null)
                   .Sum(cmd => {
     cmd(db);
     return(db.SaveChanges());
 }));
Exemplo n.º 3
0
 public ModCommandRepositoryLogic(
     IQueryCommandService <IUnitOfWork> unitOfWork,
     ILogger logger
     )
 {
     _unitOfWork = unitOfWork;
     _logger     = logger;
 }
Exemplo n.º 4
0
 public QueryQueryService(
     IQueryCommandService queryCommandService,
     IAdministrationUnitOfWork unitOfWork,
     ILog log,
     IServiceAuthorizationPolicy authorizationPolicy,
     IServiceIdentityProvider identityProvider)
     : base(unitOfWork, log, authorizationPolicy, identityProvider)
 {
     _queryCommandService = queryCommandService;
     _inboundServiceProxy = new InboundServiceProxy();
 }
 public StreamStateServiceProvider(
     IQueryCommandService <IUnitOfWork> unitOfWork,
     ITimeService timeService,
     IDownloadMapper downloadMapper,
     ISettings settings
     )
 {
     _unitOfWork     = unitOfWork;
     _timeService    = timeService;
     _downloadMapper = downloadMapper;
     _settings       = settings;
 }
Exemplo n.º 6
0
        public QueryController(IUserQueryService userQueryService,
                               IAgencyQueryService agencyQueryService,
                               IQueryQueryService queriesQueryService,
                               IQueryCommandService queriesCommandService)
        {
            _userQueryService      = userQueryService;
            _agencyQueryService    = agencyQueryService;
            _queriesQueryService   = queriesQueryService;
            _queriesCommandService = queriesCommandService;

            //Get the Tenant Name from the setting in the web.config
            //TTMS expects a Tenant Name and RMS does not have the concept of a Tenant
            _tenantName = ConfigurationManager.AppSettings["TenantName"];
        }
Exemplo n.º 7
0
 public PeriodicMessages(
     IQueryCommandService <IUnitOfWork> unitOfWork,
     IFactory <TimeSpan, Action, Task> periodicTaskFactory,
     ISettings settings,
     IPipelineManager pipelineManager,
     IFactory <string> latestYoutubeFactory
     )
 {
     _periodicTaskFactory  = periodicTaskFactory;
     _pipelineManager      = pipelineManager;
     _latestYoutubeFactory = latestYoutubeFactory;
     _unitOfWork           = unitOfWork;
     _settings             = settings;
 }
 public PeriodicTwitterStatusUpdater(
     IFactory <TimeSpan, Action, Task> periodicTaskFactory,
     IQueryCommandService <IUnitOfWork> unitOfWork,
     IPipelineManager pipelineManager,
     ITwitterManager twitterManager,
     ISettings settings
     )
 {
     _periodicTaskFactory = periodicTaskFactory;
     _unitOfWork          = unitOfWork;
     _pipelineManager     = pipelineManager;
     _twitterManager      = twitterManager;
     _settings            = settings;
 }
 public CivilianPublicMessageToSendablesFactory(
     IErrorableFactory <ISnapshot <Civilian, PublicMessage>, IReadOnlyList <ISendable <ITransmittable> > > punishmentFactory,
     IErrorableFactory <ISnapshot <IUser, IMessage>, IReadOnlyList <ISendable <ITransmittable> > > commandFactory,
     IQueryCommandService <IUnitOfWork> repository,
     ITimeService timeService,
     ISettings settings
     )
 {
     _punishmentFactory = punishmentFactory;
     _commandFactory    = commandFactory;
     _repository        = repository;
     _timeService       = timeService;
     _settings          = settings;
 }
Exemplo n.º 10
0
 public TwitterManager(
     IPrivateConstants privateConstants,
     ILogger logger,
     ITwitterStreamingMessageObserver twitterObserver,
     IQueryCommandService <IUnitOfWork> unitOfWork,
     IFactory <Status, string, IEnumerable <string> > twitterStatusFormatter,
     ITimeService timeService
     )
 {
     _privateConstants       = privateConstants;
     _logger                 = logger;
     _twitterObserver        = twitterObserver;
     _unitOfWork             = unitOfWork;
     _twitterStatusFormatter = twitterStatusFormatter;
     _timeService            = timeService;
 }
Exemplo n.º 11
0
        public StreamStateService(
            IQueryCommandService <IUnitOfWork> unitOfWork,
            ITimeService timeService,
            IDownloadMapper downloadMapper,
            ISettings settings
            )
        {
            _unitOfWork     = unitOfWork;
            _timeService    = timeService;
            _downloadMapper = downloadMapper;

            _onStatus          = new OnStatus(this);
            _offStatus         = new OffStatus(this);
            _possiblyOffStatus = new PossiblyOffStatus(this, _unitOfWork, _timeService, settings);

            var initialStatus = unitOfWork.Query(u => u.StateIntegers.StreamStatus);

            _latestStreamOnTime  = unitOfWork.Query(u => u.StateIntegers.LatestStreamOnTime);
            _latestStreamOffTime = unitOfWork.Query(u => u.StateIntegers.LatestStreamOffTime);
            switch (initialStatus)
            {
            case StreamStatus.On:
                _currentStatus = _onStatus;
                break;

            case StreamStatus.Off:
                _currentStatus = _offStatus;
                break;

            case StreamStatus.PossiblyOff:
                _currentStatus = _possiblyOffStatus;
                break;

            default:
                throw new NotSupportedException($"The stream status {initialStatus} is not registered");
            }
        }
Exemplo n.º 12
0
 public ScopedQueryCommandServiceDecorator(IQueryCommandService <TContext> decoratedQueryCommandService, IScopeCreator lifetimeScoper)
 {
     this._decoratedQueryCommandService = decoratedQueryCommandService;
     this._lifetimeScoper = lifetimeScoper;
 }
Exemplo n.º 13
0
 public RepositoryInitializer(IQueryCommandService <IBotDbContext> queryCommandService)
 {
     _queryCommandService = queryCommandService;
     _databaseInitializer = new DatabaseInitializer(_queryCommandService);
 }
 public RepositoryPunishmentFactory(IQueryCommandService <IUnitOfWork> unitOfWork, ILogger logger)
 {
     _unitOfWork = unitOfWork;
     _logger     = logger;
 }
        private static void AddMute(IModCommandRepositoryLogic modCommandLogic, string mutedPhrase, TimeSpan firstDuration, IQueryCommandService <IUnitOfWork> unitOfWork)
        {
            modCommandLogic.AddMute(mutedPhrase, firstDuration);
            var autoPunishments = unitOfWork.Query(u => u.AutoPunishments.GetAllWithUser);
            var autoPunishment  = autoPunishments.Single();

            Assert.AreEqual(mutedPhrase, autoPunishment.Term);
            Assert.AreEqual(AutoPunishmentType.MutedString, autoPunishment.Type);
            Assert.AreEqual(firstDuration, autoPunishment.Duration);
        }
Exemplo n.º 16
0
 public AegisPardonFactory(IModCommandRegex modCommandRegex, IFactory <IReceived <Moderator, IMessage>, Nuke> nukeFactory, IQueryCommandService <IUnitOfWork> unitOfWork, ISettings settings, ITimeService timeService) : base(settings, timeService)
 {
     _modCommandRegex = modCommandRegex;
     _nukeFactory     = nukeFactory;
     _unitOfWork      = unitOfWork;
 }
Exemplo n.º 17
0
 public CommandFactory(IQueryCommandService <IUnitOfWork> repository, ICommandLogic commandLogic)
 {
     _repository   = repository;
     _commandLogic = commandLogic;
 }
Exemplo n.º 18
0
 public NukeMuteFactory(ISettings settings, ITimeService timeService, IQueryCommandService <IUnitOfWork> repository) : base(settings, timeService)
 {
     _settings   = settings;
     _repository = repository;
 }
Exemplo n.º 19
0
 public DatabaseInitializer(IQueryCommandService <IBotDbContext> queryCommandService)
 {
     _queryCommandService = queryCommandService;
 }