Ejemplo n.º 1
0
        public AccessToken Find(string accessToken)
        {
            AccessToken token = _cache == null ? null : _cache.Get <AccessToken>(accessToken);

            if (token == null)    // Not in cache, read Raven
            {
                token = _dbContext.Query <AccessToken>().FirstOrDefault(x => x.Token == accessToken);
                if (token != null)
                {
                    _cache.Add(token.Token, token, new TimeSpan(0, 20, 0));
                }
            }
            return(token);
        }
Ejemplo n.º 2
0
        public IEnumerable <User> GetByIds(List <int> ids)
        {
            ids = ids.Distinct().ToList();
            var users = new List <User>();
            int page  = 0;

            do
            {
                List <int> batch = ListUtilities.GetPageItems(ids, 1000, page++);

                if (batch.Count > 0)
                {
                    users.AddRange(_dbContext.Query <User>().Where(u => u.Id.In(batch)));
                }
                else
                {
                    return(users);
                }
            } while (true);
        }
Ejemplo n.º 3
0
 public IEnumerable <IFeatureSetting> GetForTenant(int tenantId)
 {
     return(_dbContext.Query <TenantProductFeature>().Where(x => x.TenantId == tenantId).Take(int.MaxValue).AsEnumerable());
 }
Ejemplo n.º 4
0
 public List <TaskInstance> GetAll() =>
 _dbContext.Query <TaskInstance>().ToList();
Ejemplo n.º 5
0
 public List <Tenant> GetAll() => _dbContext.Query <Tenant>().ToList();