コード例 #1
0
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();
            GlobalConfiguration.Configure(WebApiConfig.Register);
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);

            ScoreBoardContext context = new ScoreBoardContext();

            DbInitializer.Initialize(context);
        }
コード例 #2
0
        public VerifyService(IConnectionFactory factory, ScoreBoardContext context)
        {
            _factory    = factory;
            _context    = context;
            _connection = _factory.CreateConnection();
            _connection.ConnectionShutdown += _connection_ConnectionShutdown;
            _channel = _connection.CreateModel();
            _channel.QueueDeclare(queue: "verify_response_queue", durable: true, exclusive: false, autoDelete: false, arguments: null);
            _channel.BasicQos(prefetchSize: 0, prefetchCount: 1, global: false);

            _consumer           = new  EventingBasicConsumer(_channel);
            _consumer.Received += _consumer_Received;

            _channel.BasicConsume(queue: "verify_response_queue", noAck: true, consumer: _consumer);
        }
コード例 #3
0
        public ThresholdService(ScoreBoardContext context)
        {
            _context = context;

            _thresholds = new List <ThresholdData>();

            //get number of players
            var q = (from a in _context.Scores
                     group a by a.Players into playergroups
                     select playergroups.Key).ToList();

            //setup thresholds
            foreach (var numberofplayers in q)
            {
                var currentlist = _context.Scores.Where(p => p.Players == numberofplayers).OrderByDescending(r => r.Lenght).Take(10).Select(r => r.Lenght).ToList();
                var current     = new ThresholdData(currentlist, numberofplayers);
                _thresholds.Add(current);
            }
        }
コード例 #4
0
 public ScoresController(ScoreBoardContext context, ThresholdService threshold, IConnectionFactory connectionFactory)
 {
     _context           = context;
     _thresholdService  = threshold;
     _connectionFactory = connectionFactory;
 }
コード例 #5
0
 public ScoreBoardsController(ScoreBoardContext context)
 {
     _context = context;
 }