Exemple #1
0
 private void SetConnectionModelInternal(ServiceConnectionModel model)
 {
     if (model == null)
     {
         this.baseUri  = null;
         this.password = null;
         this.comp     = null;
     }
     else
     {
         this.baseUri  = string.IsNullOrEmpty(model.Address) ? null : new Uri(model.Address.EndsWith("/") ? model.Address : (model.Address + "/"));
         this.password = model.Password ?? string.Empty;
         this.comp     = model.Competition;
     }
 }
        public static ServiceConnectionModel FromSql(SqlConnection cn)
        {
            if (cn == null)
            {
                throw new ArgumentNullException("cn");
            }

            CheckOnlineStorage(cn);

            string result = null;

            using (var cmd = new SqlCommand())
            {
                cmd.Connection  = cn;
                cmd.CommandText = "SELECT top 1 setting_value FROM st0_online_settings(nolock)";
                result          = cmd.ExecuteScalar() as string;
            }

            return(string.IsNullOrEmpty(result) ? null : ServiceConnectionModel.FromString(result));
        }
Exemple #3
0
 public void Load(SqlConnection cn)
 {
     this.DoActionWithWriteLock(() => this.SetConnectionModelInternal(ServiceConnectionModel.FromSql(cn)));
 }