Esempio n. 1
0
        public void WriteSql(string sql, Dictionary <string, object> parameters)
        {
            if (sql.IsEmpty())
            {
                throw new TfException("SQL not provided.");
            }

            if (this.SqlCommand == null)
            {
                this.SqlCommand = this.SqlConnection.CreateCommand();
            }

            TfDebug.WriteLine("Executing query", sql);

            this.SqlCommand.CommandText = sql;

            if (parameters != null)
            {
                foreach (var parameter in parameters)
                {
                    this.SqlCommand.Parameters.Add(ConnectProvider.SqlParameter(parameter.Key, parameter.Value));
                }

                TfDebug.WriteLine("SQL Parameters", string.Join(Environment.NewLine, parameters));
            }
        }
Esempio n. 2
0
 public Connect()
 {
     this.SqlConnection = ConnectProvider.SqlConnection();
 }
Esempio n. 3
0
 public Connect(string sql, Dictionary <string, object> parameters)
 {
     this.SqlConnection = ConnectProvider.SqlConnection();
     this.WriteSql(sql, parameters);
 }