public void ExecuteInsertCommand(IDbTransaction p_transaction, object p_object) { TableInformation t_tableInformation = this.GetTableInformations(p_object.GetType()); SqlCommandHelper t_sqlHelper = new SqlCommandHelper(m_providerConfiguration, t_tableInformation); string t_sql = t_sqlHelper.CreateInsert(p_object); IDbCommand t_cmd = p_transaction.Connection.CreateCommand(); foreach (FieldInformation t_currFieldinformation in t_tableInformation.Fields) { if (t_currFieldinformation.IsPrimaryKey) { continue; } IDbDataParameter t_param = t_cmd.CreateParameter(); t_param.ParameterName = t_sqlHelper.CreateParameterName(t_currFieldinformation.Name); t_param.Value = p_object.GetType().GetProperty(t_currFieldinformation.PropertyName).GetValue(p_object, null); t_cmd.Parameters.Add(t_param); } t_cmd.CommandText = t_sql.ToString(); t_cmd.Transaction = p_transaction; t_cmd.ExecuteNonQuery(); IDbCommand t_cmdIDRetriever = p_transaction.Connection.CreateCommand(); t_cmdIDRetriever.Transaction = p_transaction; t_cmdIDRetriever.CommandText = t_sqlHelper.CreateGetLastInsertId(t_tableInformation.PrimaryKey.Name); object t_outParam = t_cmdIDRetriever.ExecuteScalar(); p_object.GetType().GetProperty(t_tableInformation.PrimaryKey.PropertyName).SetValue(p_object, Convert.ToInt32(t_outParam), null); }