<commit_before>using System;
using System.Data;

using NHibernate.Engine;
namespace NHibernate.Transaction 
{
	/// <summary>
	/// Wraps an ADO.NET transaction to implements the <c>ITransaction</c> interface
	/// </summary>
	/// <remarks>
	/// TODO: DESIGNQUESTION: We might want to rename this AdoTransaction to indicate this Transaction object is specific
	/// to ADO.NET.  It seems like in the Java world your Transaction objects are much more flexible - allowing
	/// for JDBC Transactions or JTA Transactions.  
	/// </remarks>
	public class Transaction : ITransaction 
	{
		private static readonly log4net.ILog log = log4net.LogManager.GetLogger(typeof(Transaction));
		private ISessionImplementor session;
		private IDbTransaction trans;
		private bool begun;
		private bool committed;
		private bool rolledBack;

		public Transaction(ISessionImplementor session) 
		{
			this.session = session;
		}

		public void Enlist(IDbCommand command) 
		{
			if( trans==null ) 
			{
				if(command.Transaction!=null) 
				{
					log.Warn("set a nonnull IDbCommand.Transaction to null because the Session had no Transaction");
				}
				command.Transaction = null;
				return;
			}
			else 
			{
				
				// got into here because the command was being initialized and had a null Transaction - probably
				// don't need to be confused by that - just a normal part of initialization...
				if(command.Transaction!=null) 
				{
					log.Warn("The IDbCommand had a different Transaction than the Session.  This can occur when " +
						"Disconnecting and Reconnecting Sessions because the PreparedCommand Cache is Session specific.");
				}
		
				command.Transaction = trans; 
			}
		}
<commit_msg>NH-159 - modified so there is not an unnecessary log message about commands and transactions not being consistent.<commit_after>using System;
using System.Data;

using NHibernate.Engine;
namespace NHibernate.Transaction 
{
	/// <summary>
	/// Wraps an ADO.NET transaction to implements the <c>ITransaction</c> interface
	/// </summary>
	/// <remarks>
	/// TODO: DESIGNQUESTION: We might want to rename this AdoTransaction to indicate this Transaction object is specific
	/// to ADO.NET.  It seems like in the Java world your Transaction objects are much more flexible - allowing
	/// for JDBC Transactions or JTA Transactions.  
	/// </remarks>
	public class Transaction : ITransaction 
	{
		private static readonly log4net.ILog log = log4net.LogManager.GetLogger(typeof(Transaction));
		private ISessionImplementor session;
		private IDbTransaction trans;
		private bool begun;
		private bool committed;
		private bool rolledBack;

		public Transaction(ISessionImplementor session) 
		{
			this.session = session;
		}

		public void Enlist(IDbCommand command) 
		{
			if( trans==null ) 
			{
				if( log.IsWarnEnabled ) 
				{
					if( command.Transaction!=null ) 
					{
						log.Warn("set a nonnull IDbCommand.Transaction to null because the Session had no Transaction");
					}
				}

				command.Transaction = null;
				return;
			}
			else 
			{
				if( log.IsWarnEnabled ) 
				{
					// got into here because the command was being initialized and had a null Transaction - probably
					// don't need to be confused by that - just a normal part of initialization...
					if( command.Transaction!=null && command.Transaction!=trans ) 
					{
						log.Warn("The IDbCommand had a different Transaction than the Session.  This can occur when " +
							"Disconnecting and Reconnecting Sessions because the PreparedCommand Cache is Session specific.");
					}
				}
		
				command.Transaction = trans; 
			}
		}

{'fraction_non_alphanumeric': 0.08259423503325942, 'fraction_numerical': 0.0019401330376940134, 'mean_word_length': 3.1435132032146957, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2127520', 'n_tokens_mistral': 1190, 'n_tokens_neox': 988, 'n_words': 359}