public OrderCreatedHandler(IDatabaseContextFactory databaseContextFactory,
                                   IOrderProcessViewQuery orderProcessViewQuery)
        {
            Guard.AgainstNull(databaseContextFactory, "databaseContextFactory");
            Guard.AgainstNull(orderProcessViewQuery, "orderProcessViewQuery");

            _databaseContextFactory = databaseContextFactory;
            _orderProcessViewQuery  = orderProcessViewQuery;
        }
        public EventProcessingObserver(IDatabaseContextFactory databaseContextFactory,
                                       IProjectionConfiguration projectionConfiguration)
        {
            Guard.AgainstNull(databaseContextFactory, "databaseContextFactory");
            Guard.AgainstNull(projectionConfiguration, "projectionConfiguration");

            _databaseContextFactory  = databaseContextFactory;
            _projectionConfiguration = projectionConfiguration;
        }
 /// <summary>
 /// Construct a <see cref="WatchdogFactory"/>
 /// </summary>
 /// <param name="serverControl">The value of <see cref="serverControl"/></param>
 /// <param name="loggerFactory">The value of <see cref="loggerFactory"/></param>
 /// <param name="databaseContextFactory">The value of <see cref="databaseContextFactory"/></param>
 /// <param name="byondTopicSender">The value of <see cref="byondTopicSender"/></param>
 /// <param name="jobManager">The value of <see cref="jobManager"/></param>
 /// <param name="asyncDelayer">The value of <see cref="asyncDelayer"/></param>
 public WatchdogFactory(IServerControl serverControl, ILoggerFactory loggerFactory, IDatabaseContextFactory databaseContextFactory, IByondTopicSender byondTopicSender, IJobManager jobManager, IAsyncDelayer asyncDelayer)
 {
     this.serverControl          = serverControl ?? throw new ArgumentNullException(nameof(serverControl));
     this.loggerFactory          = loggerFactory ?? throw new ArgumentNullException(nameof(loggerFactory));
     this.databaseContextFactory = databaseContextFactory ?? throw new ArgumentNullException(nameof(databaseContextFactory));
     this.byondTopicSender       = byondTopicSender ?? throw new ArgumentNullException(nameof(byondTopicSender));
     this.jobManager             = jobManager ?? throw new ArgumentNullException(nameof(jobManager));
     this.asyncDelayer           = asyncDelayer ?? throw new ArgumentNullException(nameof(asyncDelayer));
 }
Example #4
0
        public OrderProcessAcceptedHandler(IDatabaseContextFactory databaseContextFactory,
                                           IOrderProcessViewQuery orderProcessViewQuery)
        {
            Guard.AgainstNull(databaseContextFactory, nameof(databaseContextFactory));
            Guard.AgainstNull(orderProcessViewQuery, nameof(orderProcessViewQuery));

            _databaseContextFactory = databaseContextFactory;
            _orderProcessViewQuery  = orderProcessViewQuery;
        }
Example #5
0
        public MostKillsCommand(CommandConfiguration config, ITranslationLookup translationLookup, IDatabaseContextFactory contextFactory) : base(config, translationLookup)
        {
            Name        = "mostkills";
            Description = translationLookup["PLUGINS_STATS_COMMANDS_MOSTKILLS_DESC"];
            Alias       = "mk";
            Permission  = EFClient.Permission.User;

            _contextFactory = contextFactory;
            _config         = config;
        }
Example #6
0
        public RoleHandler(IDatabaseContextFactory databaseContextFactory, IEventStore eventStore, IKeyStore keyStore)
        {
            Guard.AgainstNull(databaseContextFactory, nameof(databaseContextFactory));
            Guard.AgainstNull(eventStore, nameof(eventStore));
            Guard.AgainstNull(keyStore, nameof(keyStore));

            _databaseContextFactory = databaseContextFactory;
            _eventStore             = eventStore;
            _keyStore = keyStore;
        }
Example #7
0
        public BeatmapManager(Storage storage, IDatabaseContextFactory contextFactory, RulesetStore rulesets, APIAccess api, IIpcHost importHost = null)
            : base(storage, contextFactory, new BeatmapStore(contextFactory), importHost)
        {
            beatmaps = (BeatmapStore)ModelStore;
            beatmaps.BeatmapHidden   += b => BeatmapHidden?.Invoke(b);
            beatmaps.BeatmapRestored += b => BeatmapRestored?.Invoke(b);

            this.rulesets = rulesets;
            this.api      = api;
        }
Example #8
0
 /// <summary>
 /// Initializes a new instance of the <see cref="GitHubRemoteDeploymentManager"/> <see langword="class"/>.
 /// </summary>
 /// <param name="databaseContextFactory">The value of <see cref="databaseContextFactory"/>.</param>
 /// <param name="gitHubClientFactory">The value of <see cref="gitHubClientFactory"/>.</param>
 /// <param name="logger">The <see cref="ILogger"/> for the <see cref="BaseRemoteDeploymentManager"/>.</param>
 /// <param name="metadata">The <see cref="Api.Models.Instance"/> for the <see cref="BaseRemoteDeploymentManager"/>.</param>
 public GitHubRemoteDeploymentManager(
     IDatabaseContextFactory databaseContextFactory,
     IGitHubClientFactory gitHubClientFactory,
     ILogger <GitHubRemoteDeploymentManager> logger,
     Api.Models.Instance metadata)
     : base(logger, metadata)
 {
     this.databaseContextFactory = databaseContextFactory ?? throw new ArgumentNullException(nameof(databaseContextFactory));
     this.gitHubClientFactory    = gitHubClientFactory ?? throw new ArgumentNullException(nameof(gitHubClientFactory));
 }
        public QueuesController(IServiceBus bus, IDatabaseContextFactory databaseContextFactory, IQueueQuery queueQuery)
        {
            Guard.AgainstNull(databaseContextFactory, nameof(databaseContextFactory));
            Guard.AgainstNull(queueQuery, nameof(queueQuery));
            Guard.AgainstNull(bus, nameof(bus));

            _databaseContextFactory = databaseContextFactory;
            _queueQuery             = queueQuery;
            _bus = bus;
        }
Example #10
0
 public ServerDistributionCalculator(IDatabaseContextFactory contextFactory,
                                     IDataValueCache <EFClientStatistics, Dictionary <long, Extensions.LogParams> > distributionCache,
                                     IDataValueCache <EFClientStatistics, double> maxZScoreCache,
                                     IConfigurationHandlerFactory configFactory)
 {
     _contextFactory       = contextFactory;
     _distributionCache    = distributionCache;
     _maxZScoreCache       = maxZScoreCache;
     _configurationHandler = configFactory.GetConfigurationHandler <StatsConfiguration>("StatsPluginSettings");
 }
        public OrderProcessService(IServiceBus bus, IDatabaseContextFactory databaseContextFactory, IOrderProcessViewQuery orderProcessViewQuery)
        {
            Guard.AgainstNull(bus, "bus");
            Guard.AgainstNull(databaseContextFactory, "databaseContextFactory");
            Guard.AgainstNull(orderProcessViewQuery, "orderProcessViewQuery");

            _bus = bus;
            _databaseContextFactory = databaseContextFactory;
            _orderProcessViewQuery  = orderProcessViewQuery;
        }
Example #12
0
        public ReadMessageCommand(CommandConfiguration config, ITranslationLookup layout,
                                  IDatabaseContextFactory contextFactory, ILogger <IDatabaseContextFactory> logger) : base(config, layout)
        {
            Name        = "readmessage";
            Description = _translationLookup["COMMANDS_READ_MESSAGE_DESC"];
            Alias       = "rm";
            Permission  = EFClient.Permission.Flagged;

            _contextFactory = contextFactory;
            _logger         = logger;
        }
Example #13
0
        public void Setup()
        {
            serviceProvider = new ServiceCollection()
                              .AddSingleton <ClientService>()
                              .BuildBase()

                              .BuildServiceProvider();

            contextFactory = serviceProvider.GetRequiredService <IDatabaseContextFactory>();
            clientService  = serviceProvider.GetRequiredService <ClientService>();
        }
        public RulesetStore(IDatabaseContextFactory factory)
            : base(factory)
        {
            // On android in release configuration assemblies are loaded from the apk directly into memory.
            // We cannot read assemblies from cwd, so should check loaded assemblies instead.
            loadFromAppDomain();
            loadFromDisk();
            addMissingRulesets();

            AppDomain.CurrentDomain.AssemblyResolve += resolveRulesetAssembly;
        }
Example #15
0
        public TestExecutionHandler(IDatabaseContextFactory databaseContextFactory,
                                    IExecutionService executionService, ITestRepository testRepository)
        {
            Guard.AgainstNull(databaseContextFactory, nameof(databaseContextFactory));
            Guard.AgainstNull(executionService, nameof(executionService));
            Guard.AgainstNull(testRepository, nameof(testRepository));

            _databaseContextFactory = databaseContextFactory;
            _executionService       = executionService;
            _testRepository         = testRepository;
        }
        public RequiresSessionAttribute(IAccessConfiguration configuration,
                                        IDatabaseContextFactory databaseContextFactory, ISessionQuery sessionQuery)
        {
            Guard.AgainstNull(configuration, nameof(configuration));
            Guard.AgainstNull(databaseContextFactory, nameof(databaseContextFactory));
            Guard.AgainstNull(sessionQuery, nameof(sessionQuery));

            _configuration          = configuration;
            _databaseContextFactory = databaseContextFactory;
            _sessionQuery           = sessionQuery;
        }
Example #17
0
        public BeatmapModelManager(Storage storage, IDatabaseContextFactory contextFactory, RulesetStore rulesets, GameHost host = null)
            : base(storage, contextFactory, new BeatmapStore(contextFactory), host)
        {
            this.rulesets = rulesets;

            beatmaps = (BeatmapStore)ModelStore;
            beatmaps.BeatmapHidden   += b => BeatmapHidden?.Invoke(b);
            beatmaps.BeatmapRestored += b => BeatmapRestored?.Invoke(b);
            beatmaps.ItemRemoved     += b => WorkingBeatmapCache?.Invalidate(b);
            beatmaps.ItemUpdated     += obj => WorkingBeatmapCache?.Invalidate(obj);
        }
Example #18
0
        public RolesController(IServiceBus bus, IDatabaseContextFactory databaseContextFactory,
                               ISystemRoleQuery systemRoleQuery)
        {
            Guard.AgainstNull(databaseContextFactory, nameof(databaseContextFactory));
            Guard.AgainstNull(bus, nameof(bus));
            Guard.AgainstNull(systemRoleQuery, nameof(systemRoleQuery));

            _databaseContextFactory = databaseContextFactory;
            _bus             = bus;
            _systemRoleQuery = systemRoleQuery;
        }
        public UserProjectionHandler(IProjectionConfiguration configuration, IDatabaseContextFactory databaseContextFactory,
                                     ISystemUserQuery query)
        {
            Guard.AgainstNull(configuration, "configuration");
            Guard.AgainstNull(databaseContextFactory, "databaseContextFactory");
            Guard.AgainstNull(query, "query");

            _configuration          = configuration;
            _databaseContextFactory = databaseContextFactory;
            _query = query;
        }
Example #20
0
        /// <summary>
        /// Construct an <see cref="InstanceManager"/>
        /// </summary>
        /// <param name="instanceFactory">The value of <see cref="instanceFactory"/></param>
        /// <param name="ioManager">The value of <paramref name="ioManager"/></param>
        /// <param name="databaseContextFactory">The value of <paramref name="databaseContextFactory"/></param>
        /// <param name="application">The value of <see cref="application"/></param>
        /// <param name="jobManager">The value of <see cref="jobManager"/></param>
        /// <param name="logger">The value of <see cref="logger"/></param>
        public InstanceManager(IInstanceFactory instanceFactory, IIOManager ioManager, IDatabaseContextFactory databaseContextFactory, IApplication application, IJobManager jobManager, ILogger <InstanceManager> logger)
        {
            this.instanceFactory        = instanceFactory ?? throw new ArgumentNullException(nameof(instanceFactory));
            this.ioManager              = ioManager ?? throw new ArgumentNullException(nameof(ioManager));
            this.databaseContextFactory = databaseContextFactory ?? throw new ArgumentNullException(nameof(databaseContextFactory));
            this.application            = application ?? throw new ArgumentNullException(nameof(application));
            this.jobManager             = jobManager ?? throw new ArgumentNullException(nameof(jobManager));
            this.logger = logger ?? throw new ArgumentNullException(nameof(logger));

            instances = new Dictionary <long, IInstance>();
        }
Example #21
0
        public RegisterDocumentHandler(IMalwareService malwareService,
                                       IDatabaseContextFactory databaseContextFactory, IDocumentRepository documentRepository)
        {
            Guard.AgainstNull(malwareService, nameof(malwareService));
            Guard.AgainstNull(databaseContextFactory, nameof(databaseContextFactory));
            Guard.AgainstNull(documentRepository, nameof(documentRepository));

            _malwareService         = malwareService;
            _databaseContextFactory = databaseContextFactory;
            _documentRepository     = documentRepository;
        }
Example #22
0
        public RegisterEndpointHandler(IDatabaseContextFactory databaseContextFactory, IEndpointQuery endpointQuery,
                                       ISentinelConfiguration configuration)
        {
            Guard.AgainstNull(databaseContextFactory, nameof(databaseContextFactory));
            Guard.AgainstNull(endpointQuery, nameof(endpointQuery));
            Guard.AgainstNull(configuration, nameof(configuration));

            _databaseContextFactory = databaseContextFactory;
            _endpointQuery          = endpointQuery;
            _configuration          = configuration;
        }
Example #23
0
        public MostPlayedCommand(CommandConfiguration config, ITranslationLookup translationLookup,
                                 IDatabaseContextFactory contextFactory) : base(config, translationLookup)
        {
            Name           = "mostplayed";
            Description    = translationLookup["PLUGINS_STATS_COMMANDS_MOSTPLAYED_DESC"];
            Alias          = "mp";
            Permission     = EFClient.Permission.User;
            RequiresTarget = false;

            _config         = config;
            _contextFactory = contextFactory;
        }
        public ServerDataCollector(ILogger <ServerDataCollector> logger, ApplicationConfiguration appConfig,
                                   IManager manager, IDatabaseContextFactory contextFactory, IEventPublisher eventPublisher)
        {
            _logger         = logger;
            _appConfig      = appConfig;
            _manager        = manager;
            _contextFactory = contextFactory;
            _eventPublisher = eventPublisher;

            _eventPublisher.OnClientConnect    += SaveConnectionInfo;
            _eventPublisher.OnClientDisconnect += SaveConnectionInfo;
        }
        public OfflineMessageCommand(CommandConfiguration config, ITranslationLookup layout,
                                     IDatabaseContextFactory contextFactory, ILogger <IDatabaseContextFactory> logger) : base(config, layout)
        {
            Name           = "offlinemessage";
            Description    = _translationLookup["COMMANDS_OFFLINE_MESSAGE_DESC"];
            Alias          = "om";
            Permission     = EFClient.Permission.Moderator;
            RequiresTarget = true;

            _contextFactory = contextFactory;
            _logger         = logger;
        }
Example #26
0
 public StatsController(ILogger <StatsController> logger, IManager manager, IResourceQueryHelper <ChatSearchQuery,
                                                                                                  MessageResponse> resourceQueryHelper, ITranslationLookup translationLookup,
                        IDatabaseContextFactory contextFactory,
                        IConfigurationHandler <StatsConfiguration> configurationHandler) : base(manager)
 {
     _logger  = logger;
     _manager = manager;
     _chatResourceQueryHelper = resourceQueryHelper;
     _translationLookup       = translationLookup;
     _contextFactory          = contextFactory;
     _configurationHandler    = configurationHandler;
 }
Example #27
0
        public ResetStats(CommandConfiguration config, ITranslationLookup translationLookup,
                          IDatabaseContextFactory contextFactory) : base(config, translationLookup)
        {
            Name               = "resetstats";
            Description        = translationLookup["PLUGINS_STATS_COMMANDS_RESET_DESC"];
            Alias              = "rs";
            Permission         = EFClient.Permission.User;
            RequiresTarget     = false;
            AllowImpersonation = true;

            _contextFactory = contextFactory;
        }
Example #28
0
 /// <summary>
 /// Construct a <see cref="WatchdogFactory"/>
 /// </summary>
 /// <param name="chat">The value of <see cref="chat"/></param>
 /// <param name="sessionControllerFactory">The value of <see cref="sessionControllerFactory"/></param>
 /// <param name="serverUpdater">The value of <see cref="serverUpdater"/></param>
 /// <param name="loggerFactory">The value of <see cref="loggerFactory"/></param>
 /// <param name="reattachInfoHandler">The value of <see cref="reattachInfoHandler"/></param>
 /// <param name="databaseContextFactory">The value of <see cref="databaseContextFactory"/></param>
 /// <param name="byondTopicSender">The value of <see cref="byondTopicSender"/></param>
 /// <param name="eventConsumer">The value of <see cref="eventConsumer"/></param>
 /// <param name="instance">The value of <see cref="instance"/></param>
 public WatchdogFactory(IChat chat, ISessionControllerFactory sessionControllerFactory, IServerControl serverUpdater, ILoggerFactory loggerFactory, IReattachInfoHandler reattachInfoHandler, IDatabaseContextFactory databaseContextFactory, IByondTopicSender byondTopicSender, IEventConsumer eventConsumer, Api.Models.Instance instance)
 {
     this.chat = chat ?? throw new ArgumentNullException(nameof(chat));
     this.sessionControllerFactory = sessionControllerFactory ?? throw new ArgumentNullException(nameof(sessionControllerFactory));
     this.serverUpdater            = serverUpdater ?? throw new ArgumentNullException(nameof(serverUpdater));
     this.loggerFactory            = loggerFactory ?? throw new ArgumentNullException(nameof(loggerFactory));
     this.reattachInfoHandler      = reattachInfoHandler ?? throw new ArgumentNullException(nameof(reattachInfoHandler));
     this.databaseContextFactory   = databaseContextFactory ?? throw new ArgumentNullException(nameof(databaseContextFactory));
     this.byondTopicSender         = byondTopicSender ?? throw new ArgumentNullException(nameof(byondTopicSender));
     this.eventConsumer            = eventConsumer ?? throw new ArgumentNullException(nameof(eventConsumer));
     this.instance = instance ?? throw new ArgumentNullException(nameof(instance));
 }
Example #29
0
        /// <summary>
        /// Construct a <see cref="DmbFactory"/>
        /// </summary>
        /// <param name="databaseContextFactory">The value of <see cref="databaseContextFactory"/></param>
        /// <param name="ioManager">The value of <see cref="ioManager"/></param>
        /// <param name="logger">The value of <see cref="logger"/></param>
        /// <param name="instance">The value of <see cref="instance"/></param>
        public DmbFactory(IDatabaseContextFactory databaseContextFactory, IIOManager ioManager, ILogger <DmbFactory> logger, Api.Models.Instance instance)
        {
            this.databaseContextFactory = databaseContextFactory ?? throw new ArgumentNullException(nameof(databaseContextFactory));
            this.ioManager = ioManager ?? throw new ArgumentNullException(nameof(ioManager));
            this.logger    = logger ?? throw new ArgumentNullException(nameof(logger));
            this.instance  = instance ?? throw new ArgumentNullException(nameof(instance));

            cleanupTask   = Task.CompletedTask;
            newerDmbTcs   = new TaskCompletionSource <object>();
            cleanupCts    = new CancellationTokenSource();
            jobLockCounts = new Dictionary <long, int>();
        }
Example #30
0
        /// <summary>
        /// Initializes a new instance of the <see cref="WatchdogBase"/> <see langword="class"/>.
        /// </summary>
        /// <param name="chat">The value of <see cref="Chat"/></param>
        /// <param name="sessionControllerFactory">The value of <see cref="SessionControllerFactory"/></param>
        /// <param name="dmbFactory">The value of <see cref="DmbFactory"/></param>
        /// <param name="reattachInfoHandler">The value of <see cref="reattachInfoHandler"/></param>
        /// <param name="databaseContextFactory">The value of <see cref="databaseContextFactory"/></param>
        /// <param name="byondTopicSender">The value of <see cref="byondTopicSender"/></param>
        /// <param name="eventConsumer">The value of <see cref="eventConsumer"/></param>
        /// <param name="jobManager">The value of <see cref="jobManager"/></param>
        /// <param name="serverControl">The <see cref="IServerControl"/> to populate <see cref="restartRegistration"/> with</param>
        /// <param name="asyncDelayer">The value of <see cref="AsyncDelayer"/>.</param>
        /// <param name="logger">The value of <see cref="Logger"/></param>
        /// <param name="initialLaunchParameters">The initial value of <see cref="ActiveLaunchParameters"/>. May be modified</param>
        /// <param name="instance">The value of <see cref="instance"/></param>
        /// <param name="autoStart">The value of <see cref="autoStart"/></param>
        protected WatchdogBase(
            IChat chat,
            ISessionControllerFactory sessionControllerFactory,
            IDmbFactory dmbFactory,
            IReattachInfoHandler reattachInfoHandler,
            IDatabaseContextFactory databaseContextFactory,
            IByondTopicSender byondTopicSender,
            IEventConsumer eventConsumer,
            IJobManager jobManager,
            IServerControl serverControl,
            IAsyncDelayer asyncDelayer,
            ILogger logger,
            DreamDaemonLaunchParameters initialLaunchParameters,
            Api.Models.Instance instance,
            bool autoStart)
        {
            Chat = chat ?? throw new ArgumentNullException(nameof(chat));
            SessionControllerFactory = sessionControllerFactory ?? throw new ArgumentNullException(nameof(sessionControllerFactory));
            DmbFactory                  = dmbFactory ?? throw new ArgumentNullException(nameof(dmbFactory));
            AsyncDelayer                = asyncDelayer ?? throw new ArgumentNullException(nameof(asyncDelayer));
            this.reattachInfoHandler    = reattachInfoHandler ?? throw new ArgumentNullException(nameof(reattachInfoHandler));
            this.databaseContextFactory = databaseContextFactory ?? throw new ArgumentNullException(nameof(databaseContextFactory));
            this.byondTopicSender       = byondTopicSender ?? throw new ArgumentNullException(nameof(byondTopicSender));
            this.eventConsumer          = eventConsumer ?? throw new ArgumentNullException(nameof(eventConsumer));
            this.jobManager             = jobManager ?? throw new ArgumentNullException(nameof(jobManager));
            Logger = logger ?? throw new ArgumentNullException(nameof(logger));
            ActiveLaunchParameters = initialLaunchParameters ?? throw new ArgumentNullException(nameof(initialLaunchParameters));
            this.instance          = instance ?? throw new ArgumentNullException(nameof(instance));
            this.autoStart         = autoStart;

            if (serverControl == null)
            {
                throw new ArgumentNullException(nameof(serverControl));
            }

            chat.RegisterCommandHandler(this);

            ActiveLaunchParameters  = initialLaunchParameters;
            releaseServers          = false;
            ActiveParametersUpdated = new TaskCompletionSource <object>();

            restartRegistration = serverControl.RegisterForRestart(this);
            try
            {
                Semaphore = new SemaphoreSlim(1);
            }
            catch
            {
                restartRegistration.Dispose();
                throw;
            }
        }
		public ProcessModule(IDatabaseContextFactory databaseContextFactory, IEventStore eventStore, IKeyStore keyStore,
			IProcessConfiguration configuration)
		{
			Guard.AgainstNull(databaseContextFactory, "databaseContextFactory");
			Guard.AgainstNull(eventStore, "eventStore");
			Guard.AgainstNull(keyStore, "keyStore");
			Guard.AgainstNull(configuration, "configuration");

			_databaseContextFactory = databaseContextFactory;
			_eventStore = eventStore;
			_keyStore = keyStore;
			_configuration = configuration;
		}
		public ProcessMessageHandlerInvoker(IDatabaseContextFactory databaseContextFactory, IEventStore eventStore,
			IKeyStore keyStore,
			IProcessConfiguration configuration)
		{
			Guard.AgainstNull(databaseContextFactory, "databaseContextFactory");
			Guard.AgainstNull(eventStore, "eventStore");
			Guard.AgainstNull(eventStore, "keyStore");
			Guard.AgainstNull(configuration, "configuration");

			_databaseContextFactory = databaseContextFactory;
			_eventStore = eventStore;
			_keyStore = keyStore;
			_configuration = configuration;

			_defaultMessageHandlerInvoker = new DefaultMessageHandlerInvoker();
		}
Example #33
0
 public ScoresController(IDatabaseContextFactory databaseContextFactory)
 {
     this.databaseContextFactory = databaseContextFactory;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="DevComUnitOfWork"/> class.
 /// </summary>
 /// <param name="contextFactory">
 /// The context factory.
 /// </param>
 /// <param name="postRepository">
 /// The post Repository.
 /// </param>
 public DevComUnitOfWork(IDatabaseContextFactory<DevComContext> contextFactory, IPostRepository postRepository)
 {
     this.postRepository = postRepository;
     this.context = contextFactory.GetContext();
 }