コード例 #1
0
        public SettingsDatabase(SettingsDbContext context)
        {
            this.context = context;

#if DEBUG
            context.Database.Log = Log.Logger;
#endif
        }
コード例 #2
0
        public SettingsDatabase(SettingsDbContext context)
        {
            this.context = context;

            #if DEBUG
            context.Database.Log = Log.Logger;
            #endif
        }
コード例 #3
0
        public void SetUsed(string apiKey)
        {
            try
            {
                using (var context = new SettingsDbContext())
                {
                    var data = context.ApiKeys.SingleOrDefault(a => a.ApiKey == apiKey);

                    if (data != null)
                    {
                        data.LastUsed = DateTime.UtcNow;
                        context.SaveChanges();
                    }
                }
            }
            catch (Exception ex)
            {
                Log.Exception(ex);
                throw new SettingsStoreException(Constants.ERROR_STORE_UNAVAILABLE, ex);
            }
        }
コード例 #4
0
        public void SetUsed(string apiKey)
        {
            try
            {
                using (var context = new SettingsDbContext())
                {
                    var data = context.ApiKeys.SingleOrDefault(a => a.ApiKey == apiKey);

                    if (data != null)
                    {
                        data.LastUsed = DateTime.UtcNow;
                        context.SaveChanges();
                    }
                }
            }
            catch (Exception ex)
            {
                Log.Exception(ex);
                throw new SettingsStoreException(Constants.ERROR_STORE_UNAVAILABLE, ex);
            }
        }
コード例 #5
0
        public bool IsValid(string key, out int keyId)
        {
            keyId = 0;

            try
            {
                using (var context = new SettingsDbContext())
                {
                    ApiKeyData data = context.ApiKeys.SingleOrDefault(a => a.ApiKey == key);
                    if (data != null)
                    {
                        keyId = data.Id;
                        return data.Active;
                    }
                    return false;
                }
            }
            catch (Exception ex)
            {
                Log.Exception(ex);
                throw new SettingsStoreException(Constants.ERROR_STORE_UNAVAILABLE, ex);
            }
        }
コード例 #6
0
        public bool IsValid(string key, out int keyId)
        {
            keyId = 0;

            try
            {
                using (var context = new SettingsDbContext())
                {
                    ApiKeyData data = context.ApiKeys.SingleOrDefault(a => a.ApiKey == key);
                    if (data != null)
                    {
                        keyId = data.Id;
                        return(data.Active);
                    }
                    return(false);
                }
            }
            catch (Exception ex)
            {
                Log.Exception(ex);
                throw new SettingsStoreException(Constants.ERROR_STORE_UNAVAILABLE, ex);
            }
        }
コード例 #7
0
 public ValidationRepository()
 {
     _context = new SettingsDbContext();
 }
コード例 #8
0
 public ValidationRepository()
 {
     _context = new SettingsDbContext();
 }