示例#1
0
 public DepartmentsController(IUnitOfWork unitOfWork, IDepartmentRepository departmentRepository, IRedisConnectionFactory cache, IMediator mediator)
 {
     _unitOfWork           = unitOfWork;
     _departmentRepository = departmentRepository;
     _cache    = cache;
     _mediator = mediator;
 }
示例#2
0
 public PortsController(IUnitOfWork unitOfWork, IPortRepository portRepository, IRedisConnectionFactory cache, IMediator mediator)
 {
     _unitOfWork     = unitOfWork;
     _portRepository = portRepository;
     _cache          = cache;
     _mediator       = mediator;
 }
示例#3
0
 public PeriodTypesController(IUnitOfWork unitOfWork, IPeriodTypeRepository periodTypeRepository, IRedisConnectionFactory cache, IMediator mediator)
 {
     _unitOfWork           = unitOfWork;
     _periodTypeRepository = periodTypeRepository;
     _cache    = cache;
     _mediator = mediator;
 }
示例#4
0
 public ProfitCentersController(IUnitOfWork unitOfWork, IProfitCenterRepository profitCenterRepository, IRedisConnectionFactory cache, IMediator mediator)
 {
     _unitOfWork             = unitOfWork;
     _profitCenterRepository = profitCenterRepository;
     _cache    = cache;
     _mediator = mediator;
 }
示例#5
0
 public ArbitrationsController(IUnitOfWork unitOfWork, IArbitrationRepository arbitrationRepository, IRedisConnectionFactory cache, IMediator mediator)
 {
     _unitOfWork            = unitOfWork;
     _arbitrationRepository = arbitrationRepository;
     _cache    = cache;
     _mediator = mediator;
 }
示例#6
0
 public PaymentTermsController(IUnitOfWork unitOfWork, IPaymentTermsRepository paymentTermsRepository, IRedisConnectionFactory cache, IMediator mediator)
 {
     _unitOfWork             = unitOfWork;
     _paymentTermsRepository = paymentTermsRepository;
     _cache    = cache;
     _mediator = mediator;
 }
 public HomeController(ILogger <HomeController> logger, IOptions <RedisConfiguration> redis, IDistributedCache cache, IRedisConnectionFactory factory)
 {
     _logger = logger;
     _redis  = redis.Value;
     _cache  = cache;
     _fact   = factory;
 }
示例#8
0
 public RegionsController(IUnitOfWork unitOfWork, IRegionRepository regionRepository, IRedisConnectionFactory cache, IMediator mediator)
 {
     _unitOfWork       = unitOfWork;
     _regionRepository = regionRepository;
     _cache            = cache;
     _mediator         = mediator;
 }
示例#9
0
 public CompaniesController(IUnitOfWork unitOfWork, ICompanyRepository companyRepository, ISystemDateTimeService systemDateTimeService, IRedisConnectionFactory cache)
 {
     _unitOfWork            = unitOfWork;
     _companyRepository     = companyRepository;
     _systemDateTimeService = systemDateTimeService;
     _cache = cache;
 }
示例#10
0
 public WeightUnitsController(IUnitOfWork unitOfWork, IWeightUnitRepository weightUnitRepository, IRedisConnectionFactory cache, IMediator mediator)
 {
     _unitOfWork           = unitOfWork;
     _weightUnitRepository = weightUnitRepository;
     _cache    = cache;
     _mediator = mediator;
 }
示例#11
0
 public ContractTermsController(IUnitOfWork unitOfWork, IContractTermsRepository contractTermsRepository, IRedisConnectionFactory cache, IMediator mediator)
 {
     _unitOfWork = unitOfWork;
     _contractTermsRepository = contractTermsRepository;
     _cache    = cache;
     _mediator = mediator;
 }
示例#12
0
 public BusinessSectorsController(IUnitOfWork unitOfWork, IBusinessSectorRepository businessSectorRepository, IRedisConnectionFactory cache, IMediator mediator)
 {
     _unitOfWork = unitOfWork;
     _businessSectorRepository = businessSectorRepository;
     _cache    = cache;
     _mediator = mediator;
 }
示例#13
0
        public OrdersController(IBusClient _client, IRedisConnectionFactory cachingDB)
        {
            this.cachingDB = cachingDB.Connection().GetDatabase();
            client         = _client;
            client.SubscribeAsync <Orders, MessageContext>(
                (order, ctx) => {
                if (order.NumOfPlaces >= order.NumOfPeople)//the order received
                {
                    order.ValidateReservation = true;
                }
                else
                {
                    order.ValidateReservation = false;
                }
                int result        = order.NumOfPlaces - order.NumOfPeople;
                order.NumOfPlaces = result;  //update

                var hc         = Helpers.CouchDBConnect.GetClient("orders");
                string json    = JsonConvert.SerializeObject(order);
                var jsonObject = Newtonsoft.Json.Linq.JObject.Parse(json);
                jsonObject.Remove("_rev");
                jsonObject.Remove("_id");
                json            = jsonObject.ToString();
                HttpContent htc = new StringContent(json, System.Text.Encoding.UTF8, "application/json");
                hc.PostAsync("", htc);

                Console.WriteLine("order FirstName: {0} LastName: {1} PhoneNumber: {2}, RestaurantName: {3}, NumOfPeople: {4},time: {5}", order.FirstName, order.LastName, order.PhoneNumber, order.RestaurantName, order.NumOfPeople, order.time);
                return(Task.FromResult(0));
            }
                );
        }
示例#14
0
 public ShippingStatusController(IUnitOfWork unitOfWork, IShippingStatusRepository shippingStatusRepository, IRedisConnectionFactory cache, IMediator mediator)
 {
     _unitOfWork = unitOfWork;
     _shippingStatusRepository = shippingStatusRepository;
     _cache    = cache;
     _mediator = mediator;
 }
示例#15
0
 public VesselsController(IUnitOfWork unitOfWork, IVesselRepository vesselRepository, IRedisConnectionFactory cache, IMediator mediator)
 {
     _unitOfWork       = unitOfWork;
     _vesselRepository = vesselRepository;
     _cache            = cache;
     _mediator         = mediator;
 }
示例#16
0
 public CurrenciesController(IUnitOfWork unitOfWork, ICurrencyRepository currencyRepository, IRedisConnectionFactory cache, IMediator mediator)
 {
     _unitOfWork         = unitOfWork;
     _currencyRepository = currencyRepository;
     _cache    = cache;
     _mediator = mediator;
 }
 public RedisCacheManager(IRedisConnectionFactory connectionFactory)
 {
     _connection    = connectionFactory.GetConnection();
     _cacheSettings = connectionFactory.CacheSettings;
     _database      = _connection.GetDatabase();
     this._lock     = new object();
 }
示例#18
0
 // public Chat(DatabaseContext db, UserTracker tracker, IDistributedCache cache)
 public Chat(DatabaseContext db, UserTracker tracker, IRedisConnectionFactory fact)
 {
     _db       = db;
     _tracker  = tracker;
     _fact     = fact;
     _redis_db = _fact.Connection();
 }
示例#19
0
 public NominalAccountsController(IUnitOfWork unitOfWork, INominalAccountRepository repo, IRedisConnectionFactory cache, IMediator mediator)
 {
     _unitOfWork = unitOfWork;
     _nominalAccountRepository = repo;
     _cache    = cache;
     _mediator = mediator;
 }
示例#20
0
 public CounterpartiesController(IUnitOfWork unitOfWork, ICounterpartyRepository counterpartyRepository, IRedisConnectionFactory cache, ICounterpartyQueries counterpartyQueries, IMediator mediator)
 {
     _unitOfWork             = unitOfWork;
     _counterpartyRepository = counterpartyRepository;
     _cache = cache;
     _counterpartyQueries = counterpartyQueries;
     _mediator            = mediator;
 }
示例#21
0
 public MatchTask(IBaseEngine engine, ILogger <CatergoryTask> logger, IOptions <AppSettings> settings, IServiceScopeFactory services, IRedisConnectionFactory factory)
 {
     serviceScopeFactory = services;
     _engine             = (HttpClientEngine)engine;
     _logger             = logger;
     _settings           = settings.Value;
     _fact = factory;
 }
示例#22
0
 public OddsTask(PuppeteerEngine engine, ILogger <CatergoryTask> logger, IOptions <AppSettings> settings, IServiceScopeFactory services, IOptions <RedisConfiguration> redis, IRedisConnectionFactory factory)
 {
     serviceScopeFactory = services;
     _logger             = logger;
     _settings           = settings.Value;
     _redis  = redis.Value;
     _fact   = factory;
     _engine = engine;
 }
示例#23
0
 public NotificationController(PeiuGridDataContext peiuGridDataContext, IRedisConnectionFactory redis,
                               AccountDataContext accountContext,
                               IClaimServiceFactory claimServiceFactory)
 {
     this.peiuGridDataContext = peiuGridDataContext;
     db = redis.Connection().GetDatabase(1);
     this.claimServiceFactory = claimServiceFactory;
     this._accountContext     = accountContext;
 }
示例#24
0
        internal RedisLogger(string key, ILog log, IRedisConnectionFactory redisConnectionFactory)
        {
            this.key = string.Format(CultureInfo.InvariantCulture, "{0}:{1}", log.Logger.Name, key);
            this.log = log;
            this.messagesSubject = new ReplaySubject<Tuple<string, string>>(100, TimeSpan.FromSeconds(5));
            this.retry = new BehaviorSubject<bool>(false);

            var redisOnConnectionAction = new Action<Task<RedisConnection>>(task =>
            {
                if (task.IsCompleted && !task.IsFaulted)
                {
                    Interlocked.CompareExchange<RedisConnection>(ref this.redisConnection, task.Result, null);
                    subscription = messagesSubject.TakeUntil(retry.Skip(1)).Subscribe((item) => 
                        {
                            redisConnection.Publish(item.Item1, item.Item2).ContinueWith(taskWithException =>
                                {
                                    taskWithException.Exception.Handle(ex => true);
                                }, TaskContinuationOptions.OnlyOnFaulted);
                        });
                }
            });

            var redisOnErrorAction = new Action<ErrorEventArgs>(ex =>
                {
                    if (ex.IsFatal)
                    {
                        retry.OnNext(true);
                        Interlocked.Exchange<RedisConnection>(ref this.redisConnection, null);
                    }
                });

            Action subscribeAction = () =>
            {
                var connectionTask = redisConnectionFactory.CreateRedisConnection();
                connectionTask.ContinueWith(taskConnection =>
                    {
                        if (!taskConnection.IsFaulted)
                        {
                            taskConnection.ContinueWith(redisOnConnectionAction);
                            taskConnection.Result.Error += (_, err) => redisOnErrorAction(err);
                        }
                        else
                        {
                            taskConnection.Exception.Handle(_ => true);
                            this.retry.OnNext(true);
                        }
                    });
            };

            retry.Subscribe(val =>
                {
                    if (val)
                        Observable.Timer(TimeSpan.FromSeconds(10)).Subscribe(_ => subscribeAction()); 
                    else
                        subscribeAction();
                });
        }
示例#25
0
 public PriceUnitsController(
     IPriceUnitRepository priceUnitRepository,
     IRedisConnectionFactory cache,
     IMediator mediator)
 {
     _priceUnitRepository = priceUnitRepository;
     _cache    = cache;
     _mediator = mediator;
 }
示例#26
0
 public SendBulkEmail(IEmailSender emailSender, DatabaseContext db, UserTracker tracker, IRedisConnectionFactory fact, IHostingEnvironment env)
 {
     _db          = db;
     _emailSender = emailSender;
     _tracker     = tracker;
     _fact        = fact;
     _env         = env;
     _redis_db    = fact.Connection();
 }
 public NotificationController(PeiuGridDataContext peiuGridDataContext, IRedisConnectionFactory redis,
                               AccountEF accountContext, ILogger <NotificationController> logger, IClaimServiceFactory claimsManager,
                               IClaimServiceFactory claimServiceFactory)
 {
     this.peiuGridDataContext = peiuGridDataContext;
     db = redis.Connection().GetDatabase(1);
     this._accountContext = accountContext;
     this.logger          = logger;
     this._claimsManager  = claimsManager;
 }
 public RedisController()
 {
     //TODO: use IOC
     _redisConfiguration      = new RedisConfiguration();
     _redisConfiguration.Host = ConfigurationManager.AppSettings["redisHost"];
     _redisConfiguration.Port = ConfigurationManager.AppSettings["redisPort"];
     _redisConfiguration.Name = ConfigurationManager.AppSettings["redisName"];
     _redisConnectionFactory  = new RedisConnectionFactory(_redisConfiguration);
     _redisService            = new RedisService <Vote>(_redisConnectionFactory);
 }
示例#29
0
        public MyProductRepository(
            HttpClient httpClient,
            IOptions <ServiceDependenciesConfig> serviceDependenciesConfig,
            IRedisConnectionFactory redisConnectionFactory)
            : base(httpClient)
        {
            ServiceDependenciesConfig = serviceDependenciesConfig.Value;

            RedisDatabase = redisConnectionFactory.Connection().GetDatabase();
        }
        public FilesController(IBusClient _client, IRedisConnectionFactory caching)
        {
            client    = _client;
            cachingDB = caching.Connection().GetDatabase();

            client.SubscribeAsync <String>(async(json) =>
            {
                // download image and upload it with the new user as owner
                await CopyFile(json);
            });
        }
示例#31
0
 public DeviceController(IRedisConnectionFactory redisConnectionFactory,
                         IDataAccess mysql_dataAccess,
                         IModbusFactory modbusFactory, ILoggerFactory loggerFactory)
 {
     redis_ai      = redisConnectionFactory.Connection().GetDatabase(1);
     redis_di      = redisConnectionFactory.Connection().GetDatabase();
     modbus        = modbusFactory;
     modbus_master = modbus.GetModbusMaster();
     logger        = loggerFactory.CreateLogger <DeviceController>();
     dataAccess    = mysql_dataAccess;
 }
示例#32
0
 public HomeController(IRedisConnectionFactory connectionFactory)
 {
     _connectionFactory = connectionFactory;
     _i = 1;
         //_connectionFactory.GetConnection().RedisString().As<SomethingToStore>().Urn(string.Format(@"{0}{1}", UrnPrefix, _i)).Get().Id++;
 }
示例#33
0
 public ILog ObserverKey(string key, ILog log, IRedisConnectionFactory redisConnectionFactory)
 {
     return new RedisLogger(key, log, redisConnectionFactory);
 }