示例#1
0
        public void ExecuteDeleteCommand(IDbTransaction p_transaction, object p_object)
        {
            TableInformation t_tableInformation = this.GetTableInformations(p_object.GetType());
            SqlCommandHelper t_sqlHelper        = new SqlCommandHelper(this.m_providerConfiguration, t_tableInformation);

            string t_sql = t_sqlHelper.CreateDeleteByPrimaryKey();

            IDbCommand cmd = p_transaction.Connection.CreateCommand();

            cmd.Transaction = p_transaction;
            cmd.CommandText = t_sql;

            IDbDataParameter t_param = cmd.CreateParameter();

            t_param.ParameterName = t_sqlHelper.CreateParameterName(t_tableInformation.PrimaryKey.Name);
            t_param.Value         = p_object.GetType().GetProperty(t_tableInformation.PrimaryKey.PropertyName).GetValue(p_object, null);
            cmd.Parameters.Add(t_param);

            cmd.ExecuteNonQuery();
        }